vendor tsgo
This commit is contained in:
50
tools/tsgo/internal/testrunner/compiler_runner_test.go
Normal file
50
tools/tsgo/internal/testrunner/compiler_runner_test.go
Normal file
@@ -0,0 +1,50 @@
|
||||
package testrunner
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/microsoft/typescript-go/internal/bundled"
|
||||
"github.com/microsoft/typescript-go/internal/collections"
|
||||
"github.com/microsoft/typescript-go/internal/repo"
|
||||
"github.com/microsoft/typescript-go/internal/tspath"
|
||||
"gotest.tools/v3/assert"
|
||||
)
|
||||
|
||||
// Runs the new compiler tests and produces baselines (e.g. `test1.symbols`).
|
||||
func TestLocal(t *testing.T) { runCompilerTests(t, false) } //nolint:paralleltest
|
||||
|
||||
// Runs the old compiler tests, and produces new baselines (e.g. `test1.symbols`)
|
||||
// and a diff between the new and old baselines (e.g. `test1.symbols.diff`).
|
||||
func TestSubmodule(t *testing.T) { runCompilerTests(t, true) } //nolint:paralleltest
|
||||
|
||||
func runCompilerTests(t *testing.T, isSubmodule bool) {
|
||||
t.Parallel()
|
||||
|
||||
if isSubmodule {
|
||||
repo.SkipIfNoTypeScriptSubmodule(t)
|
||||
}
|
||||
|
||||
if !bundled.Embedded {
|
||||
// Without embedding, we'd need to read all of the lib files out from disk into the MapFS.
|
||||
// Just skip this for now.
|
||||
t.Skip("bundled files are not embedded")
|
||||
}
|
||||
|
||||
runners := []*CompilerBaselineRunner{
|
||||
NewCompilerBaselineRunner(TestTypeRegression, isSubmodule),
|
||||
NewCompilerBaselineRunner(TestTypeConformance, isSubmodule),
|
||||
}
|
||||
|
||||
var seenTests collections.Set[string]
|
||||
for _, runner := range runners {
|
||||
for _, test := range runner.EnumerateTestFiles() {
|
||||
test = tspath.GetBaseFileName(test)
|
||||
assert.Assert(t, !seenTests.Has(test), "Duplicate test file: %s", test)
|
||||
seenTests.Add(test)
|
||||
}
|
||||
}
|
||||
|
||||
for _, runner := range runners {
|
||||
runner.RunTests(t)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user