diff options
author | eldritch horrors <pennae@lix.systems> | 2024-01-29 06:19:23 +0100 |
---|---|---|
committer | eldritch horrors <pennae@lix.systems> | 2024-03-18 16:12:46 +0100 |
commit | c39150e6bb4dd04bc60f1d9c13b7bc89d55948a8 (patch) | |
tree | 4f0f450e789b151037a76729ea61713d75fba5cb /tests | |
parent | 4c072c7c5f5e574ace6a3c3a1e07cb5db25a4487 (diff) |
diagnose "unexpected EOF" at EOF
this needs a string comparison because there seems to be no other way to
get that information out of bison. usually the location info is going to
be correct (pointing at a bad token), but since EOF isn't a token as
such it'll be wrong in that this case.
this hasn't shown up much so far because a single line ending *is* a
token, so any file formatted in the usual manner (ie, ending in a line
ending) would have its EOF position reported correctly.
(cherry picked from commit 855fd5a1bb781e4f722c1d757ba43e866d370132)
Change-Id: I120c56a962f4286b1ae3b71da7b71ce8ec3e0535
Diffstat (limited to 'tests')
-rw-r--r-- | tests/functional/lang/parse-fail-eof-in-string.err.exp | 4 | ||||
-rw-r--r-- | tests/functional/lang/parse-fail-eof-pos.err.exp | 5 | ||||
-rw-r--r-- | tests/functional/lang/parse-fail-eof-pos.nix | 2 |
3 files changed, 9 insertions, 2 deletions
diff --git a/tests/functional/lang/parse-fail-eof-in-string.err.exp b/tests/functional/lang/parse-fail-eof-in-string.err.exp index b28d35950..17f34b62d 100644 --- a/tests/functional/lang/parse-fail-eof-in-string.err.exp +++ b/tests/functional/lang/parse-fail-eof-in-string.err.exp @@ -1,5 +1,5 @@ error: syntax error, unexpected end of file, expecting '"' - at «stdin»:3:5: + at «stdin»:3:6: 2| # Note that this file must not end with a newline. 3| a 1"$ - | ^ + | ^ diff --git a/tests/functional/lang/parse-fail-eof-pos.err.exp b/tests/functional/lang/parse-fail-eof-pos.err.exp new file mode 100644 index 000000000..ef9ca381c --- /dev/null +++ b/tests/functional/lang/parse-fail-eof-pos.err.exp @@ -0,0 +1,5 @@ +error: syntax error, unexpected end of file + at «stdin»:3:1: + 2| # no content + 3| + | ^ diff --git a/tests/functional/lang/parse-fail-eof-pos.nix b/tests/functional/lang/parse-fail-eof-pos.nix new file mode 100644 index 000000000..bd66a2c98 --- /dev/null +++ b/tests/functional/lang/parse-fail-eof-pos.nix @@ -0,0 +1,2 @@ +( +# no content |