message: Introduce underlining for error message regions.
[pspp] / tests / language / lexer / lexer.at
index f13940bd6767d43585a4ce2887ef945b83c01bd8..725c26065706a0ac419a4458de3d0131ba8dea69 100644 (file)
@@ -1,16 +1,16 @@
 dnl PSPP - a program for statistical analysis.
 dnl Copyright (C) 2017 Free Software Foundation, Inc.
-dnl 
+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
 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
 dnl You should have received a copy of the GNU General Public License
 dnl along with this program.  If not, see <http://www.gnu.org/licenses/>.
 dnl
@@ -46,7 +46,7 @@ u'110000'
 'foo
 'very long unterminated string that be ellipsized in its error message
 1e .x
-`
+^
 �
 ])
 AT_CHECK([pspp -O format=csv lexer.sps], [1], [dnl
@@ -68,13 +68,11 @@ lexer.sps:8.1-8.70: error: Syntax error at `'very long unterminated string that
 
 lexer.sps:9.1-9.2: error: Syntax error at `1e': Missing exponent following `1e'.
 
-lexer.sps:9.4: error: Syntax error at `.': Unexpected `.' in middle of command.
-
-lexer.sps:9: error: Unknown command `x'.
+lexer.sps:9.4: error: Syntax error at `.': expecting command name.
 
-lexer.sps:10.1: error: Syntax error at ``': Bad character ``' in input.
+lexer.sps:10.1: error: Syntax error at `^': Bad character `^' in input.
 
-lexer.sps:11.1: error: Syntax error at `�': Bad character U+FFFD in input.
+lexer.sps:11.1-11.2: error: Syntax error at `�': Bad character U+FFFD in input.
 ])
 AT_CLEANUP
 
@@ -84,16 +82,24 @@ AT_SETUP([lexer crash due to null byte])
 printf "datA dist list notable file='input.txt'/a b c.
 lis|.\0" > lexer.sps
 
-# We sort the output into a predictable order because the lexer finds
-# and reports null bytes as soon as it reads them into its input
-# buffer, as opposed to when it encounters them during tokenization.
-# This also means that null bytes might be reported as part of one
-# command or another or none, hence removing the LIST: prefix.
-AT_CHECK([pspp -O format=csv lexer.sps > lexer.csv], [1])
-AT_CHECK([sed '/^$/d
-s/LIST: //' lexer.csv | sort], [0], [dnl
-lexer.sps: error: Bad character U+0000 in input.
+AT_CHECK([pspp -O format=csv lexer.sps], [1], [dnl
 lexer.sps:1: error: Unknown command `datA dist'.
-lexer.sps:2: error: LIST is allowed only after the active dataset has been defined.
+
+lexer.sps:2: error: LIST: LIST is allowed only after the active dataset has been defined.
+
+lexer.sps:2.6: error: LIST: Syntax error at `...': Bad character U+0000 in input.
+])
+AT_CLEANUP
+
+
+
+
+# Bug #54684
+AT_SETUP([lexer crash due to overflow])
+printf "DATA LIST/5555555555555555." > lexer.sps
+
+AT_CHECK([pspp -O format=csv lexer.sps], [1], [dnl
+lexer.sps:1.11-1.26: error: DATA LIST: Syntax error at `5555555555555555': Expected integer between 1 and 2147483647.
 ])
+
 AT_CLEANUP