Change terminology from "active file" to "active dataset".
[pspp-builds.git] / tests / language / command.at
index 5636caff5fae56e44424cd036aa760ae17010c1c..8d65b6fb8c2998bd14a27ee8d5f4d9f9b2174587 100644 (file)
@@ -1,3 +1,18 @@
+AT_BANNER([command parser])
+
+dnl Tests for a bug which crashed pspp when given certain invalid input.
+AT_SETUP([command parser crash bug])
+AT_DATA([command.sps], [dnl
+DATA rubbish.
+EXECUTE.
+])
+AT_CHECK([pspp -O format=csv command.sps], [1], [dnl
+command.sps:1: error: Unknown command `DATA rubbish'.
+
+command.sps:2: error: EXECUTE: EXECUTE is allowed only after the active dataset has been defined.
+])
+AT_CLEANUP
+
 AT_BANNER([ERASE])
 
 AT_SETUP([ERASE -- safer mode])
@@ -25,3 +40,51 @@ erase FILE='foobar'.
 AT_CHECK([pspp -O format=csv erase.sps])
 AT_CHECK([test ! -e foobar])
 AT_CLEANUP
+
+AT_BANNER([N OF CASES])
+
+AT_SETUP([N OF CASES])
+AT_DATA([n-of-cases.sps], [dnl
+INPUT PROGRAM.
+LOOP #i = 1 TO 100.
+COMPUTE x=#i.
+END CASE.
+END LOOP.
+END FILE.
+END INPUT PROGRAM.
+
+N OF CASES 15.
+
+LIST.
+])
+AT_CHECK([pspp -O format=csv n-of-cases.sps], [0], [dnl
+Table: Data List
+x
+1.00
+2.00
+3.00
+4.00
+5.00
+6.00
+7.00
+8.00
+9.00
+10.00
+11.00
+12.00
+13.00
+14.00
+15.00
+])
+AT_CLEANUP
+
+AT_BANNER([COMMENT])
+
+dnl Tests for a bug wherein a comment just before end-of-file caused an
+dnl infinite loop.
+AT_SETUP([COMMENT at end of file])
+AT_DATA([comment.sps], [dnl
+COMMENT this is a comment at end of file.
+])
+AT_CHECK([pspp -O format=csv comment.sps])
+AT_CLEANUP