X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=tests%2Flanguage%2Fcommand.at;h=562c69b1304e22d306058eb4f1b3c028ded84711;hb=7dfac5cdb216652cb60f15499a35bb8532e2cf15;hp=e9cbb919a0c661a9ce20d86d92a46b617408489d;hpb=facb4a1ad3c9e8b2cdf55824680eed2afb91aebe;p=pspp diff --git a/tests/language/command.at b/tests/language/command.at index e9cbb919a0..562c69b130 100644 --- a/tests/language/command.at +++ b/tests/language/command.at @@ -16,6 +16,32 @@ dnl along with this program. If not, see . dnl AT_BANNER([command parser]) +AT_SETUP([command parser negative tests]) +AT_DATA([command.sps], [dnl +DATA X. +XYZZY. +CLOSE FILE XYZZY. +foo. +]) +AT_CHECK([pspp command.sps], [1], [dnl +command.sps:1.1-1.6: error: Unknown command `DATA X'. + 1 | DATA X. + | ^~~~~~ + +command.sps:2.1-2.5: error: Unknown command `XYZZY'. + 2 | XYZZY. + | ^~~~~ + +command.sps:3.1-3.16: error: Unknown command `CLOSE FILE XYZZY'. + 3 | CLOSE FILE XYZZY. + | ^~~~~~~~~~~~~~~~ + +command.sps:4.1-4.3: error: Unknown command `foo'. + 4 | foo. + | ^~~ +]) +AT_CLEANUP + dnl Tests for a bug which crashed pspp when given certain invalid input. AT_SETUP([command parser crash bug]) AT_DATA([command.sps], [dnl @@ -23,16 +49,20 @@ DATA rubbish. EXECUTE. ]) AT_CHECK([pspp -O format=csv command.sps], [1], [dnl -command.sps:1: error: Unknown command `DATA rubbish'. +"command.sps:1.1-1.12: error: Unknown command `DATA rubbish'. + 1 | DATA rubbish. + | ^~~~~~~~~~~~" -command.sps:2: error: EXECUTE: EXECUTE is allowed only after the active dataset has been defined. +"command.sps:2.1-2.7: error: EXECUTE: EXECUTE is allowed only after the active dataset has been defined. + 2 | EXECUTE. + | ^~~~~~~" ]) AT_CLEANUP dnl Tests for a bug where FINISH or EXIT wasn't executed until the lexer dnl read the first token of the next command. dnl -dnl (If this reecurs, the test will run forever.) +dnl (If this recurs, the test will run forever.) AT_SETUP([FINISH executes immediately]) AT_CHECK([(echo "FINISH."; while echo ; do true; done) | pspp], [0], [ignore], [ignore]) AT_CLEANUP @@ -48,7 +78,9 @@ set safer on erase FILE='foobar'. ]) AT_CHECK([pspp -O format=csv erase.sps], [1], [dnl -erase.sps:3: error: ERASE: This command not allowed when the SAFER option is set. +"erase.sps:3.1-3.5: error: ERASE: This command not allowed when the SAFER option is set. + 3 | erase FILE='foobar'. + | ^~~~~" ]) AT_CHECK([cat foobar], [0], [contents ])