Skip to content

Commit c69f55a

Browse files
Add test for overloads.
1 parent 188f9c7 commit c69f55a

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package fourslash_test
2+
3+
import (
4+
"testing"
5+
6+
"github.com/microsoft/typescript-go/internal/fourslash"
7+
"github.com/microsoft/typescript-go/internal/ls/lsutil"
8+
"github.com/microsoft/typescript-go/internal/testutil"
9+
)
10+
11+
func TestCodeLensOverloads01(t *testing.T) {
12+
t.Parallel()
13+
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
14+
15+
const content = `
16+
export function foo(x: number): number;
17+
export function foo(x: string): string;
18+
export function foo(x: string | number): string | number {
19+
return x;
20+
}
21+
22+
foo(1);
23+
24+
foo("hello");
25+
26+
// This one isn't expected to match any overload,
27+
// but is really just here to test how it affects how code lens.
28+
foo(Math.random() ? 1 : "hello");
29+
`
30+
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
31+
f.VerifyBaselineCodeLens(t, &lsutil.UserPreferences{
32+
ReferencesCodeLensEnabled: true,
33+
ReferencesCodeLensShowOnAllFunctions: true,
34+
35+
ImplementationsCodeLensEnabled: true,
36+
ImplementationsCodeLensShowOnInterfaceMethods: true,
37+
ImplementationsCodeLensShowOnAllClassMethods: true,
38+
})
39+
}

0 commit comments

Comments
 (0)