INPUT PROGRAM: Avoid infinite loop for trivially empty input program.
[pspp] / tests / language / data-io / inpt-pgm.at
index 7f2e143594144d0c7798ee1a990c1c5d0dd17258..480c83f1b12b48c39225ba938d42b52950ae561d 100644 (file)
@@ -13,10 +13,6 @@ END INPUT PROGRAM.
 ])
 AT_CHECK([pspp -O format=csv input-program.sps], [1], [dnl
 input-program.sps:3: error: BEGIN DATA: BEGIN DATA is not allowed inside INPUT PROGRAM.
-
-input-program.sps:4: error: Syntax error at `123456789': expecting command name.
-
-input-program.sps:5: error: Unknown command END DATA.
 ])
 AT_CLEANUP
 
@@ -32,6 +28,21 @@ END INPUT PROGRAM.
 DESCRIPTIVES x.
 ])
 AT_CHECK([pspp -O format=csv input-program.sps], [1], [dnl
-error: DESCRIPTIVES: Syntax error at end of file: expecting `BEGIN'.
+error: DESCRIPTIVES: Syntax error at end of input: expecting BEGIN.
+])
+AT_CLEANUP
+
+dnl Tests for bug #38782, an infinite loop processing an empty input program.
+AT_SETUP([INPUT PROGRAM infinite loop])
+AT_DATA([input-program.sps], [dnl
+INPUT PROGRAM.
+STRING firstname lastname (a24) / address (a80).
+END INPUT PROGRAM.
+EXECUTE.
+])
+AT_CHECK([pspp -O format=csv input-program.sps], [1], [dnl
+input-program.sps:3: error: Input program must contain DATA LIST or END FILE.
+
+input-program.sps:4: error: EXECUTE: EXECUTE is allowed only after the active dataset has been defined.
 ])
 AT_CLEANUP