aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2024-12-12 11:04:07 -0300
committerEuAndreh <eu@euandre.org>2024-12-12 11:04:07 -0300
commit597687f4aea38ef19d12e0fdaf021fa4faba8f02 (patch)
treee65ffaa7c9fc4f39826c36825e73eb81765add16 /tests
parentBuild and run existing test executables with no actual tests (diff)
downloadcotia-597687f4aea38ef19d12e0fdaf021fa4faba8f02.tar.gz
cotia-597687f4aea38ef19d12e0fdaf021fa4faba8f02.tar.xz
tests/unit/: Actually run existing tests
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/compressor/compressor.go16
-rw-r--r--tests/unit/driver/lexer/lexer.go19
-rw-r--r--tests/unit/driver/parser/parser.go23
-rw-r--r--tests/unit/grammar/grammar.go24
-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
-rw-r--r--tests/unit/grammar/symbol/symbol.go22
-rw-r--r--tests/unit/spec/grammar/parser/parser.go19
-rw-r--r--tests/unit/spec/test/test.go20
-rw-r--r--tests/unit/tester/tester.go18
-rw-r--r--tests/unit/utf8/utf8.go19
12 files changed, 231 insertions, 12 deletions
diff --git a/tests/unit/compressor/compressor.go b/tests/unit/compressor/compressor.go
index 3b760ce..cac6158 100644
--- a/tests/unit/compressor/compressor.go
+++ b/tests/unit/compressor/compressor.go
@@ -2,9 +2,13 @@ package compressor
import (
"fmt"
+ "os"
"testing"
+ "testing/internal/testdeps"
)
+
+
func TestCompressor_Compress(t *testing.T) {
x := 0 // an empty value
@@ -121,5 +125,17 @@ func TestCompressor_Compress(t *testing.T) {
}
}
+
+
func MainTest() {
+ tests := []testing.InternalTest{
+ { "TestCompressor_Compress", TestCompressor_Compress },
+ }
+
+ 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/driver/lexer/lexer.go b/tests/unit/driver/lexer/lexer.go
index 364a0f5..f01dbf7 100644
--- a/tests/unit/driver/lexer/lexer.go
+++ b/tests/unit/driver/lexer/lexer.go
@@ -3,13 +3,17 @@ package lexer
import (
"bytes"
"fmt"
+ "os"
"strings"
"testing"
+ "testing/internal/testdeps"
"urubu/grammar/lexical"
spec "urubu/spec/grammar"
)
+
+
func newLexEntry(modes []string, kind string, pattern string, push string, pop bool) *lexical.LexEntry {
ms := []spec.LexModeName{}
for _, m := range modes {
@@ -932,4 +936,17 @@ func testToken(t *testing.T, expected, actual *Token) {
}
-func MainTest() {}
+
+func MainTest() {
+ tests := []testing.InternalTest{
+ { "TestLexer_Next", TestLexer_Next },
+ { "TestLexer_Next_WithPosition", TestLexer_Next_WithPosition },
+ }
+
+ 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/driver/parser/parser.go b/tests/unit/driver/parser/parser.go
index cdf32a3..7ce5d60 100644
--- a/tests/unit/driver/parser/parser.go
+++ b/tests/unit/driver/parser/parser.go
@@ -2,15 +2,19 @@ package parser
import (
"fmt"
+ "os"
"sort"
"strings"
"testing"
+ "testing/internal/testdeps"
"urubu/grammar"
spec "urubu/spec/grammar"
"urubu/spec/grammar/parser"
)
+
+
func TestParserWithConflicts(t *testing.T) {
tests := []struct {
caption string
@@ -1972,4 +1976,21 @@ foo
}
-func MainTest() {}
+
+func MainTest() {
+ tests := []testing.InternalTest{
+ { "TestParserWithConflicts", TestParserWithConflicts },
+ { "TestParserWithLAC", TestParserWithLAC },
+ { "TestParser_Parse", TestParser_Parse },
+ { "TestParserWithSemanticAction", TestParserWithSemanticAction },
+ { "TestParserWithSyntaxErrors", TestParserWithSyntaxErrors },
+ { "TestParserWithSyntaxErrorAndExpectedLookahead", TestParserWithSyntaxErrorAndExpectedLookahead },
+ }
+
+ 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/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())
+}
diff --git a/tests/unit/spec/grammar/parser/parser.go b/tests/unit/spec/grammar/parser/parser.go
index 8170518..72cdc37 100644
--- a/tests/unit/spec/grammar/parser/parser.go
+++ b/tests/unit/spec/grammar/parser/parser.go
@@ -1,12 +1,16 @@
package parser
import (
+ "os"
"strings"
"testing"
+ "testing/internal/testdeps"
verr "urubu/error"
)
+
+
func TestLexer_Run(t *testing.T) {
idTok := func(text string) *token {
return newIDToken(text, newPosition(1, 0))
@@ -1439,4 +1443,17 @@ func testPosition(t *testing.T, pos, expected Position) {
}
-func MainTest() {}
+
+func MainTest() {
+ tests := []testing.InternalTest{
+ { "TestLexer_Run", TestLexer_Run },
+ { "TestParse", TestParse },
+ }
+
+ 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/spec/test/test.go b/tests/unit/spec/test/test.go
index c6ec8f1..0a77689 100644
--- a/tests/unit/spec/test/test.go
+++ b/tests/unit/spec/test/test.go
@@ -2,11 +2,15 @@ package test
import (
"fmt"
+ "os"
"reflect"
"strings"
"testing"
+ "testing/internal/testdeps"
)
+
+
func TestTree_Format(t *testing.T) {
expected := `(a
(b
@@ -411,4 +415,18 @@ func testTestCase(t *testing.T, expected, actual *TestCase) {
}
-func MainTest() {}
+
+func MainTest() {
+ tests := []testing.InternalTest{
+ { "TestTree_Format", TestTree_Format },
+ { "TestDiffTree", TestDiffTree },
+ { "TestParseTestCase", TestParseTestCase },
+ }
+
+ 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/tester/tester.go b/tests/unit/tester/tester.go
index 9245cc4..41e92ae 100644
--- a/tests/unit/tester/tester.go
+++ b/tests/unit/tester/tester.go
@@ -2,14 +2,18 @@ package tester
import (
"fmt"
+ "os"
"strings"
"testing"
+ "testing/internal/testdeps"
"urubu/grammar"
"urubu/spec/grammar/parser"
tspec "urubu/spec/test"
)
+
+
func TestTester_Run(t *testing.T) {
grammarSrc1 := `
#name test;
@@ -169,4 +173,16 @@ foo foo foo
}
-func MainTest() {}
+
+func MainTest() {
+ tests := []testing.InternalTest{
+ { "TestTester_Run", TestTester_Run },
+ }
+
+ 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/utf8/utf8.go b/tests/unit/utf8/utf8.go
index 278ed3e..25d5df7 100644
--- a/tests/unit/utf8/utf8.go
+++ b/tests/unit/utf8/utf8.go
@@ -2,9 +2,13 @@ package utf8
import (
"fmt"
+ "os"
"testing"
+ "testing/internal/testdeps"
)
+
+
func TestGenCharBlocks_WellFormed(t *testing.T) {
cBlk := func(from []byte, to []byte) *CharBlock {
return &CharBlock{
@@ -181,4 +185,17 @@ func TestGenCharBlocks_IllFormed(t *testing.T) {
}
-func MainTest() {}
+
+func MainTest() {
+ tests := []testing.InternalTest{
+ { "TestGenCharBlocks_WellFormed", TestGenCharBlocks_WellFormed },
+ { "TestGenCharBlocks_IllFormed", TestGenCharBlocks_IllFormed },
+ }
+
+ deps := testdeps.TestDeps{}
+ benchmarks := []testing.InternalBenchmark {}
+ fuzzTargets := []testing.InternalFuzzTarget{}
+ examples := []testing.InternalExample {}
+ m := testing.MainStart(deps, tests, benchmarks, fuzzTargets, examples)
+ os.Exit(m.Run())
+}