From 6f6903a50efcb213025ee1a44f1a7f4cdd05bf1a Mon Sep 17 00:00:00 2001 From: Jesse Portnoy Date: Wed, 19 Jul 2023 18:04:41 +0100 Subject: [PATCH] Check for parsing errors --- helpers_test.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/helpers_test.go b/helpers_test.go index 490b7f5..e2df0f9 100644 --- a/helpers_test.go +++ b/helpers_test.go @@ -4,6 +4,7 @@ import ( "bytes" "io/ioutil" "testing" + "strings" ) func getDefs(t *testing.T, filename string, data []byte, highlight_lexer string) *Def { @@ -11,10 +12,14 @@ func getDefs(t *testing.T, filename string, data []byte, highlight_lexer string) syn_dir := "./syntax_files" var defs []*Def - lerr := ParseSyntaxFiles(syn_dir, &defs) + lerr, warnings := ParseSyntaxFiles(syn_dir, &defs) if lerr != nil { t.Errorf("Couldn't get defs from '%s', error: %v\n", syn_dir, lerr) } + if (len(warnings) > 0){ + t.Errorf("Parsing ended with warnings: '%s'\n", strings.Join(warnings,";")) + } + ResolveIncludes(defs) // Always try to auto detect the best lexer:was