X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=tests%2Flanguage%2Fdata-io%2Finpt-pgm.at;h=7b28c3896d3de9d1c488cc49207bc32faae5aa53;hb=691a034d7f21;hp=7f2e143594144d0c7798ee1a990c1c5d0dd17258;hpb=53b093e43c527c8419ab560409d25e57f4c75918;p=pspp diff --git a/tests/language/data-io/inpt-pgm.at b/tests/language/data-io/inpt-pgm.at index 7f2e143594..7b28c3896d 100644 --- a/tests/language/data-io/inpt-pgm.at +++ b/tests/language/data-io/inpt-pgm.at @@ -1,4 +1,19 @@ -AT_BANNER([INPUT PROGRAM]) +dnl PSPP - a program for statistical analysis. +dnl Copyright (C) 2017 Free Software Foundation, Inc. +dnl +dnl This program is free software: you can redistribute it and/or modify +dnl it under the terms of the GNU General Public License as published by +dnl the Free Software Foundation, either version 3 of the License, or +dnl (at your option) any later version. +dnl +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +dnl GNU General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with this program. If not, see . +dnl AT_BANNER([INPUT PROGRAM]) dnl Tests for a bug which caused a crash when dnl reading invalid INPUT PROGRAM syntax. @@ -13,10 +28,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 +43,55 @@ 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 + +dnl Tests for bug #39097, a bug when an INPUT PROGRAM used VECTOR, was +dnl followed immediately by a call to proc_execute() (here via DATASET +dnl COPY), and then the input was actually used. +AT_SETUP([INPUT PROGRAM with VECTOR and EXECUTE]) +AT_DATA([input-program.sps], [dnl +INPUT PROGRAM. +VECTOR vec(5). +LOOP #c = 1 to 10. + LOOP #v = 1 to 5. + COMPUTE vec(#v) = #v. + END LOOP. + END CASE. +END LOOP. +END FILE. +END INPUT PROGRAM. +DATASET COPY x. +LIST. +]) +AT_CHECK([pspp -O format=csv input-program.sps], [0], [dnl +Table: Data List +vec1,vec2,vec3,vec4,vec5 +1.00,2.00,3.00,4.00,5.00 +1.00,2.00,3.00,4.00,5.00 +1.00,2.00,3.00,4.00,5.00 +1.00,2.00,3.00,4.00,5.00 +1.00,2.00,3.00,4.00,5.00 +1.00,2.00,3.00,4.00,5.00 +1.00,2.00,3.00,4.00,5.00 +1.00,2.00,3.00,4.00,5.00 +1.00,2.00,3.00,4.00,5.00 +1.00,2.00,3.00,4.00,5.00 ]) AT_CLEANUP