Check for parsing errors

This commit is contained in:
Jesse Portnoy
2023-07-19 18:04:41 +01:00
parent 99c6e6f45d
commit 6f6903a50e
+6 -1
View File
@@ -4,6 +4,7 @@ import (
"bytes" "bytes"
"io/ioutil" "io/ioutil"
"testing" "testing"
"strings"
) )
func getDefs(t *testing.T, filename string, data []byte, highlight_lexer string) *Def { 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" syn_dir := "./syntax_files"
var defs []*Def var defs []*Def
lerr := ParseSyntaxFiles(syn_dir, &defs) lerr, warnings := ParseSyntaxFiles(syn_dir, &defs)
if lerr != nil { if lerr != nil {
t.Errorf("Couldn't get defs from '%s', error: %v\n", syn_dir, lerr) 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) ResolveIncludes(defs)
// Always try to auto detect the best lexer:was // Always try to auto detect the best lexer:was