aboutsummaryrefslogtreecommitdiff
path: root/tests/unit/grammar/lexical
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit/grammar/lexical')
-rw-r--r--tests/unit/grammar/lexical/dfa/dfa.go21
-rw-r--r--tests/unit/grammar/lexical/lexical.go21
-rw-r--r--tests/unit/grammar/lexical/parser/parser.go21
3 files changed, 60 insertions, 3 deletions
diff --git a/tests/unit/grammar/lexical/dfa/dfa.go b/tests/unit/grammar/lexical/dfa/dfa.go
index 3233969..b3c0b75 100644
--- a/tests/unit/grammar/lexical/dfa/dfa.go
+++ b/tests/unit/grammar/lexical/dfa/dfa.go
@@ -2,13 +2,17 @@ package dfa
import (
"fmt"
+ "os"
"strings"
"testing"
+ "testing/internal/testdeps"
"urubu/grammar/lexical/parser"
spec "urubu/spec/grammar"
)
+
+
func TestGenDFA(t *testing.T) {
p := parser.NewParser(spec.LexKindName("test"), strings.NewReader("(a|b)*abb"))
cpt, err := p.Parse()
@@ -442,4 +446,19 @@ func testSymbolTable(t *testing.T, expected, actual *symbolTable) {
}
-func MainTest() {}
+
+func MainTest() {
+ tests := []testing.InternalTest{
+ { "TestGenDFA", TestGenDFA },
+ { "TestNewSymbolPosition", TestNewSymbolPosition },
+ { "TestByteTree", TestByteTree },
+ { "TestFollowAndSymbolTable", TestFollowAndSymbolTable },
+ }
+
+ deps := testdeps.TestDeps{}
+ benchmarks := []testing.InternalBenchmark {}
+ fuzzTargets := []testing.InternalFuzzTarget{}
+ examples := []testing.InternalExample {}
+ m := testing.MainStart(deps, tests, benchmarks, fuzzTargets, examples)
+ os.Exit(m.Run())
+}
diff --git a/tests/unit/grammar/lexical/lexical.go b/tests/unit/grammar/lexical/lexical.go
index 54cace4..288bd3c 100644
--- a/tests/unit/grammar/lexical/lexical.go
+++ b/tests/unit/grammar/lexical/lexical.go
@@ -3,11 +3,15 @@ package lexical
import (
"encoding/json"
"fmt"
+ "os"
"testing"
+ "testing/internal/testdeps"
spec "urubu/spec/grammar"
)
+
+
func TestLexSpec_Validate(t *testing.T) {
// We expect that the spelling inconsistency error will occur.
spec := &LexSpec{
@@ -338,4 +342,19 @@ func TestCompile(t *testing.T) {
}
-func MainTest() {}
+
+func MainTest() {
+ tests := []testing.InternalTest{
+ { "TestLexSpec_Validate", TestLexSpec_Validate },
+ { "TestSnakeCaseToUpperCamelCase", TestSnakeCaseToUpperCamelCase },
+ { "TestFindSpellingInconsistencies", TestFindSpellingInconsistencies },
+ { "TestCompile", TestCompile },
+ }
+
+ deps := testdeps.TestDeps{}
+ benchmarks := []testing.InternalBenchmark {}
+ fuzzTargets := []testing.InternalFuzzTarget{}
+ examples := []testing.InternalExample {}
+ m := testing.MainStart(deps, tests, benchmarks, fuzzTargets, examples)
+ os.Exit(m.Run())
+}
diff --git a/tests/unit/grammar/lexical/parser/parser.go b/tests/unit/grammar/lexical/parser/parser.go
index 288de95..f0ce421 100644
--- a/tests/unit/grammar/lexical/parser/parser.go
+++ b/tests/unit/grammar/lexical/parser/parser.go
@@ -2,14 +2,18 @@ package parser
import (
"fmt"
+ "os"
"reflect"
"strings"
"testing"
+ "testing/internal/testdeps"
spec "urubu/spec/grammar"
"urubu/ucd"
)
+
+
func TestLexer(t *testing.T) {
tests := []struct {
caption string
@@ -1907,4 +1911,19 @@ func testAST(t *testing.T, expected, actual CPTree) {
}
-func MainTest() {}
+
+func MainTest() {
+ tests := []testing.InternalTest{
+ { "TestLexer", TestLexer },
+ { "TestParse", TestParse },
+ { "TestParse_ContributoryPropertyIsNotExposed", TestParse_ContributoryPropertyIsNotExposed },
+ { "TestExclude", TestExclude },
+ }
+
+ deps := testdeps.TestDeps{}
+ benchmarks := []testing.InternalBenchmark {}
+ fuzzTargets := []testing.InternalFuzzTarget{}
+ examples := []testing.InternalExample {}
+ m := testing.MainStart(deps, tests, benchmarks, fuzzTargets, examples)
+ os.Exit(m.Run())
+}