vendor tsgo
This commit is contained in:
42
tools/tsgo/internal/testrunner/test_case_parser_test.go
Normal file
42
tools/tsgo/internal/testrunner/test_case_parser_test.go
Normal file
@@ -0,0 +1,42 @@
|
||||
package testrunner
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/google/go-cmp/cmp"
|
||||
"gotest.tools/v3/assert"
|
||||
)
|
||||
|
||||
func TestMakeUnitsFromTest(t *testing.T) {
|
||||
t.Parallel()
|
||||
code := `// @strict: true
|
||||
// @noEmit: true
|
||||
// @filename: firstFile.ts
|
||||
function foo() { return "a"; }
|
||||
// normal comment
|
||||
// @filename: secondFile.ts
|
||||
// some other comment
|
||||
function bar() { return "b"; }`
|
||||
testUnit1 := &testUnit{
|
||||
content: `function foo() { return "a"; }
|
||||
// normal comment`,
|
||||
name: "firstFile.ts",
|
||||
}
|
||||
testUnit2 := &testUnit{
|
||||
content: `// some other comment
|
||||
function bar() { return "b"; }`,
|
||||
name: "secondFile.ts",
|
||||
}
|
||||
testContent := testCaseContent{
|
||||
testUnitData: []*testUnit{testUnit1, testUnit2},
|
||||
tsConfig: nil,
|
||||
tsConfigFileUnitData: nil,
|
||||
symlinks: make(map[string]string),
|
||||
}
|
||||
assert.DeepEqual(
|
||||
t,
|
||||
makeUnitsFromTest(code, "simpleTest.ts"),
|
||||
testContent,
|
||||
cmp.AllowUnexported(testCaseContent{}, testUnit{}),
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user