-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add special handling for potential
advance
failure in trial mode.
In 7c18597 for #1231 we added code to handle advance failures in trial mode when synchronizing on regexps, but missed adding the same support for literals. This patch adds that missing part. Closes #1464.
- Loading branch information
Showing
4 changed files
with
86 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
tests/Baseline/spicy.types.unit.synchronize-failure-in-trial-mode-2/output
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. | ||
Confirming with state: [$xs=[]] | ||
[$xs=[[$a=b"A"]]] |
3 changes: 3 additions & 0 deletions
3
tests/Baseline/spicy.types.unit.synchronize-failure-in-trial-mode/output
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. | ||
Confirming with state: [$xs=[]] | ||
[$xs=[[$a=b"A"]]] |
44 changes: 44 additions & 0 deletions
44
tests/spicy/types/unit/synchronize-failure-in-trial-mode.spicy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# @TEST-DOC: Validates that advance errors in trial mode are handled properly. Regression test for #1231 and #1464. | ||
|
||
# @TEST-EXEC: spicy-driver -d %INPUT -F test.dat >output 2>&1 | ||
# @TEST-EXEC: btest-diff output | ||
|
||
module foo; | ||
|
||
type X = unit { | ||
a: b"A"; # Use literal for lookahead. | ||
}; | ||
|
||
public type Foo = unit { | ||
%port = 80/tcp; | ||
|
||
xs: (X &synchronize)[]; | ||
|
||
on %synced { print "Confirming with state: %s" % self; confirm; } | ||
on %done { print self; } | ||
}; | ||
|
||
# @TEST-START-NEXT | ||
module foo; | ||
|
||
type X = unit { | ||
a: /A/; # Use regexp for lookahead. | ||
}; | ||
|
||
public type Foo = unit { | ||
%port = 80/tcp; | ||
|
||
xs: (X &synchronize)[]; | ||
|
||
on %synced { print "Confirming with state: %s" % self; confirm; } | ||
on %done { print self; } | ||
}; | ||
|
||
# @TEST-START-FILE test.dat | ||
!spicy-batch v2 | ||
@begin-flow id1 stream 80/tcp | ||
@gap id1 1024 | ||
@data id1 1 | ||
A | ||
@end-flow id1 | ||
# @TEST-END-FILE |