-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: scan reads files passed on command-line
- Loading branch information
1 parent
c6b75f0
commit a91195a
Showing
2 changed files
with
26 additions
and
1 deletion.
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
25 changes: 25 additions & 0 deletions
25
tests/end-to-end/scan/reads-files-given-on-command-line.bats
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,25 @@ | ||
#!/usr/bin/env bats | ||
|
||
load '../relocate_to_temp.bash' | ||
|
||
@test "scan reads files passed on command-line" { | ||
relocate_to_temp | ||
|
||
cat << EOF > grammar | ||
skip WHITESPACE '\s' | ||
token FOO 'foo' | ||
token BAR 'bar' | ||
token ID '[A-Za-z]\w*' | ||
EOF | ||
|
||
echo "foo bar \n foobar" > in.file | ||
|
||
TOKENS="$( | ||
plccmk -c grammar && | ||
scan in.file | ||
)" | ||
|
||
[[ "$TOKENS" =~ "FOO 'foo'" ]] | ||
[[ "$TOKENS" =~ "BAR 'bar'" ]] | ||
[[ "$TOKENS" =~ "ID 'foobar'" ]] | ||
} |