diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2020-11-16 01:18:36 -0500 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2020-11-16 04:51:00 -0500 |
commit | eacb312e5b9868dba734996d6c72fc60e0d75036 (patch) | |
tree | afb7b11354b8a9f3eeca70cc7050d863c2b4191d | |
parent | 709c1724ed74bee614c9e35b99d630396822f8c3 (diff) | |
download | flex-git-eacb312e5b9868dba734996d6c72fc60e0d75036.tar.gz |
Improve instrumentation of test failures.
Also, yyinpt.txt is generated and does not need to be checked in.
-rw-r--r-- | tests/testmaker.m4 | 12 | ||||
-rw-r--r-- | tests/yyunput.txt | 1 |
2 files changed, 6 insertions, 7 deletions
diff --git a/tests/testmaker.m4 b/tests/testmaker.m4 index ad80615..2560a79 100644 --- a/tests/testmaker.m4 +++ b/tests/testmaker.m4 @@ -44,8 +44,8 @@ define(`M4_TEST_PREAMBLE', `dnl %} ')dnl close preamble define(`M4_TEST_DO', `$1;') -define(`M4_TEST_FAILMESSAGE', `fprintf(stderr,"TEST FAILED.\n"); exit(1);') -define(`M4_TEST_ASSERT', `if (!($1)) {fprintf(stderr,"ASSERT FAILED.\n"); exit(1);}') +define(`M4_TEST_FAILMESSAGE', `fprintf(stderr,"TEST FAILED: %d:\"%s\".\n", yylineno, yytext); exit(1);') +define(`M4_TEST_ASSERT', `if (!($1)) {fprintf(stderr,"ASSERT FAILED: %d:\"%s\"\n", yylineno, yytext); exit(1);}') define(`M4_TEST_POSTAMBLE', `dnl int main (int argc, char **argv) { @@ -82,8 +82,8 @@ define(`M4_TEST_PREAMBLE', `dnl %} ')dnl close preamble define(`M4_TEST_DO', `$1;') -define(`M4_TEST_FAILMESSAGE', `fprintf(stderr,"TEST FAILED.\n"); exit(1);') -define(`M4_TEST_ASSERT', `if (!$1) {fprintf(stderr,"ASSERT FAILED.\n"); exit(1);}') +define(`M4_TEST_FAILMESSAGE', `fprintf(stderr,"TEST FAILED: %d:\"%s\".\n", yylineno, yytext); exit(1);') +define(`M4_TEST_ASSERT', `if (!$1) {fprintf(stderr,"ASSERT FAILED: %d:\"%s\"\n", yylineno, yytext); exit(1);}') define(`M4_TEST_POSTAMBLE', `dnl int main (int argc, char **argv) { @@ -130,8 +130,8 @@ import ( %option emit="go" ')dnl close preamble define(`M4_TEST_DO', `$1') -define(`M4_TEST_FAILMESSAGE', `log.Fatal("TEST FAILMESSAGE"); os.Exit(1);') -define(`M4_TEST_ASSERT', `if !$1 {Fprintf(os.Stderr,"ASSERT FAILED.\n"); os.Exit(1);}') +define(`M4_TEST_FAILMESSAGE', `fmt.Fprintf(os.Stderr, "TEST FAILMESSAGE: %d:\"%s\"\n", yylineno, yytext); os.Exit(1);') +define(`M4_TEST_ASSERT', `if !$1 {fmt.Fprintf(os.Stderr,"ASSERT FAILED: %d:\"%s\"\n", yylineno, yytext); os.Exit(1);}') define(`M4_TEST_POSTAMBLE', `dnl func main(void) { lexer := new(FlexLexer) diff --git a/tests/yyunput.txt b/tests/yyunput.txt deleted file mode 100644 index 9126894..0000000 --- a/tests/yyunput.txt +++ /dev/null @@ -1 +0,0 @@ -fooick |