From 24f1a5617ae3976313ace91970d1994a1ae7cc89 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Tue, 11 Jul 2023 12:12:21 +0200 Subject: source: fix source offset accounting - When skipping the interpreter line, don't count it's newline twice - Fix reporting byte offsets beyond the end of line Signed-off-by: Jo-Philipp Wich --- tests/custom/03_stdlib/29_require | 2 +- tests/custom/03_stdlib/35_include | 2 +- tests/custom/03_stdlib/36_render | 2 +- tests/custom/03_stdlib/62_loadfile | 2 +- tests/custom/99_bugs/14_incomplete_expression_at_eof | 2 +- tests/custom/99_bugs/25_lexer_shifted_offsets | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) (limited to 'tests') diff --git a/tests/custom/03_stdlib/29_require b/tests/custom/03_stdlib/29_require index a81edb4..3736339 100644 --- a/tests/custom/03_stdlib/29_require +++ b/tests/custom/03_stdlib/29_require @@ -134,7 +134,7 @@ return { Runtime error: Unable to compile source file './files/require/test/broken.uc': | Syntax error: Expecting label - | In line 2, byte 10: + | In line 3, byte 1: | | `return {` | ^-- Near here diff --git a/tests/custom/03_stdlib/35_include b/tests/custom/03_stdlib/35_include index 83c34bb..823748a 100644 --- a/tests/custom/03_stdlib/35_include +++ b/tests/custom/03_stdlib/35_include @@ -147,7 +147,7 @@ A compilation error in the file triggers an exception. Runtime error: Unable to compile source file './files/broken.uc': | Syntax error: Expecting label - | In line 3, byte 11: + | In line 4, byte 1: | | ` return {` | Near here --^ diff --git a/tests/custom/03_stdlib/36_render b/tests/custom/03_stdlib/36_render index aa2a27b..19824cc 100644 --- a/tests/custom/03_stdlib/36_render +++ b/tests/custom/03_stdlib/36_render @@ -146,7 +146,7 @@ A compilation error in the file triggers an exception. Runtime error: Unable to compile source file './files/broken.uc': | Syntax error: Expecting label - | In line 3, byte 11: + | In line 4, byte 1: | | ` return {` | Near here --^ diff --git a/tests/custom/03_stdlib/62_loadfile b/tests/custom/03_stdlib/62_loadfile index 4926696..9aaa0cf 100644 --- a/tests/custom/03_stdlib/62_loadfile +++ b/tests/custom/03_stdlib/62_loadfile @@ -134,7 +134,7 @@ Compiling a syntax error (should fail with syntax error exception) Runtime error: Unable to compile source file './files/test6.uc': | Syntax error: Expecting expression - | In line 1, byte 5: + | In line 2, byte 1: | | `1 +` | ^-- Near here diff --git a/tests/custom/99_bugs/14_incomplete_expression_at_eof b/tests/custom/99_bugs/14_incomplete_expression_at_eof index 474e87c..fd0ddd6 100644 --- a/tests/custom/99_bugs/14_incomplete_expression_at_eof +++ b/tests/custom/99_bugs/14_incomplete_expression_at_eof @@ -3,7 +3,7 @@ buffer, the source code context line was not properly printed. -- Expect stderr -- Syntax error: Expecting expression -In line 1, byte 7: +In line 2, byte 1: `{% 1+` ^-- Near here diff --git a/tests/custom/99_bugs/25_lexer_shifted_offsets b/tests/custom/99_bugs/25_lexer_shifted_offsets index db10121..bb374ae 100644 --- a/tests/custom/99_bugs/25_lexer_shifted_offsets +++ b/tests/custom/99_bugs/25_lexer_shifted_offsets @@ -12,7 +12,7 @@ to be incorrectly shifted. -- Expect stderr -- Error -In line 3, byte 12: +In line 3, byte 13: ` die("Error");` Near here -----^ -- cgit v1.2.3