diff options
author | Jo-Philipp Wich <jo@mein.io> | 2021-04-29 00:02:06 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2021-04-29 00:11:02 +0200 |
commit | 0e245093909c0445267187b1f396630301965f1a (patch) | |
tree | efd97e10e245cb2f257ed6608c4b8d4b1c94fb2a | |
parent | e66b2ad400203c27d7a17edea2b9952f110e9020 (diff) |
lib: fix reporting source context lines at EOF
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
-rw-r--r-- | lib.c | 2 | ||||
-rw-r--r-- | tests/custom/03_bugs/14_incomplete_expression_at_eof | 16 |
2 files changed, 17 insertions, 1 deletions
@@ -131,7 +131,7 @@ format_source_context(uc_stringbuf_t *buf, uc_source *src, size_t off, bool comp len = strlen(line); rlen += len; - if (rlen > off) { + if (rlen >= off) { if (compact) ucv_stringbuf_printf(buf, "\033[2;40;97m%17s %s", source_filename(src, eline), diff --git a/tests/custom/03_bugs/14_incomplete_expression_at_eof b/tests/custom/03_bugs/14_incomplete_expression_at_eof new file mode 100644 index 0000000..474e87c --- /dev/null +++ b/tests/custom/03_bugs/14_incomplete_expression_at_eof @@ -0,0 +1,16 @@ +When an incomplete expression was parsed at the very end of the input +buffer, the source code context line was not properly printed. + +-- Expect stderr -- +Syntax error: Expecting expression +In line 1, byte 7: + + `{% 1+` + ^-- Near here + + +-- End -- + +-- Testcase -- +{% 1+ +-- End -- |