Test internal/grammar, and allow the root to import it

This commit is contained in:
2026-10-05 12:06:43 +02:00
committed by Lillem4n
parent 46895151c8
commit 41292f9d89
9 changed files with 170 additions and 33 deletions
+16
View File
@@ -0,0 +1,16 @@
package grammar
import "testing"
func TestCheckNameRefusesWhatAGrammarReserves(t *testing.T) {
for _, name := range []string{"", "-", "a as b", "a.b", "a|b", "a(b", "a{b", "a}b", "a/b", "a[b", "a]b", `a"b`} {
if CheckName(name) == nil {
t.Errorf("CheckName(%q) = nil, want an error", name)
}
}
for _, name := range []string{"a", "postal-code", "é", "a_b"} {
if err := CheckName(name); err != nil {
t.Errorf("CheckName(%q) = %v, want nil", name, err)
}
}
}