diff options
Diffstat (limited to 'tests/unit/grammar')
-rw-r--r-- | tests/unit/grammar/grammar.go | 24 | ||||
-rw-r--r-- | tests/unit/grammar/lexical/dfa/dfa.go | 21 | ||||
-rw-r--r-- | tests/unit/grammar/lexical/lexical.go | 21 | ||||
-rw-r--r-- | tests/unit/grammar/lexical/parser/parser.go | 21 | ||||
-rw-r--r-- | tests/unit/grammar/symbol/symbol.go | 22 |
5 files changed, 103 insertions, 6 deletions
diff --git a/tests/unit/grammar/grammar.go b/tests/unit/grammar/grammar.go index fe66976..20e9a02 100644 --- a/tests/unit/grammar/grammar.go +++ b/tests/unit/grammar/grammar.go @@ -2,14 +2,18 @@ package grammar import ( "fmt" + "os" "strings" "testing" + "testing/internal/testdeps" verr "urubu/error" "urubu/grammar/symbol" "urubu/spec/grammar/parser" ) + + type first struct { lhs string num int @@ -4647,4 +4651,22 @@ func withLookAhead(item *lrItem, lookAhead ...symbol.Symbol) *lrItem { } -func MainTest() {} + +func MainTest() { + tests := []testing.InternalTest{ + { "TestGenFirst", TestGenFirst }, + { "TestGrammarBuilderOK", TestGrammarBuilderOK }, + { "TestGrammarBuilderSpecError", TestGrammarBuilderSpecError }, + { "TestGenLALR1Automaton", TestGenLALR1Automaton }, + { "TestGenLR0Automaton", TestGenLR0Automaton }, + { "TestLR0AutomatonContainingEmptyProduction", TestLR0AutomatonContainingEmptyProduction }, + { "TestGenLALRParsingTable", TestGenLALRParsingTable }, + } + + 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/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()) +} diff --git a/tests/unit/grammar/symbol/symbol.go b/tests/unit/grammar/symbol/symbol.go index 3e23c2b..6888160 100644 --- a/tests/unit/grammar/symbol/symbol.go +++ b/tests/unit/grammar/symbol/symbol.go @@ -1,6 +1,12 @@ package symbol -import "testing" +import ( + "os" + "testing" + "testing/internal/testdeps" +) + + func TestSymbol(t *testing.T) { tab := NewSymbolTable() @@ -159,4 +165,16 @@ func testSymbolProperty(t *testing.T, sym Symbol, isNil, isStart, isEOF, isNonTe } -func MainTest() {} + +func MainTest() { + tests := []testing.InternalTest{ + { "TestSymbol", TestSymbol }, + } + + deps := testdeps.TestDeps{} + benchmarks := []testing.InternalBenchmark {} + fuzzTargets := []testing.InternalFuzzTarget{} + examples := []testing.InternalExample {} + m := testing.MainStart(deps, tests, benchmarks, fuzzTargets, examples) + os.Exit(m.Run()) +} |