From b8f49b1b00c624df1208cd854aa65516b47c4c11 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Tue, 15 Mar 2022 23:09:56 +0100 Subject: tests: 21_regex_literals: generalize syntax error test case Different libc implementations produce different syntax error messages on invalid regular expression patterns, so rework the test case to produce stable output across all environments. Signed-off-by: Jo-Philipp Wich --- tests/custom/00_syntax/21_regex_literals | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'tests/custom/00_syntax') diff --git a/tests/custom/00_syntax/21_regex_literals b/tests/custom/00_syntax/21_regex_literals index 6d85e97..d7ba7c4 100644 --- a/tests/custom/00_syntax/21_regex_literals +++ b/tests/custom/00_syntax/21_regex_literals @@ -73,17 +73,23 @@ In line 2, byte 2: Testing regex compilation errors. -- Expect stderr -- -Syntax error: Unmatched \{ -In line 2, byte 3: +Catched syntax error +In line 7, byte 30: - ` /foo {/` - ^-- Near here + ` die("Catched syntax error");` + Near here ----------------------------^ -- End -- -- Testcase -- {% - /foo {/ + try { + /foo (/ + } + catch (e) { + if (e.type == "Syntax error") + die("Catched syntax error"); + } %} -- End -- -- cgit v1.2.3