github.com/madlambda/nash@v0.2.2-0.20230113003044-f2284521680b/spec_test.go (about) 1 package nash 2 3 import ( 4 "bytes" 5 "io/ioutil" 6 "path/filepath" 7 "testing" 8 9 "github.com/madlambda/nash/tests" 10 "golang.org/x/exp/ebnf" 11 ) 12 13 func TestSpecificationIsSane(t *testing.T) { 14 filename := filepath.Join(tests.Projectpath, "spec.ebnf") 15 content, err := ioutil.ReadFile(filename) 16 if err != nil { 17 t.Error(err) 18 return 19 } 20 21 buf := bytes.NewBuffer(content) 22 grammar, err := ebnf.Parse(filename, buf) 23 if err != nil { 24 t.Error(err) 25 return 26 } 27 28 err = ebnf.Verify(grammar, "program") 29 if err != nil { 30 t.Error(err) 31 return 32 } 33 }