kittenipc/kitcom/internal/tsgo/fourslash/tests/gen/indirectClassInstantiation_test.go
2025-10-15 10:12:44 +03:00

75 lines
2.2 KiB
Go

package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
. "efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash/tests/util"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/ls"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/lsp/lsproto"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestIndirectClassInstantiation(t *testing.T) {
t.Parallel()
t.Skip()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `// @allowJs: true
// @Filename: something.js
function TestObj(){
this.property = "value";
}
var constructor = TestObj;
var instance = new constructor();
instance./*a*/
var class2 = function() { };
class2.prototype.blah = function() { };
var inst2 = new class2();
inst2.blah/*b*/;`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.GoToMarker(t, "a")
f.VerifyCompletions(t, nil, &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{
Exact: []fourslash.CompletionsExpectedItem{
"property",
&lsproto.CompletionItem{
Label: "blah",
SortText: PtrTo(string(ls.SortTextJavascriptIdentifiers)),
},
&lsproto.CompletionItem{
Label: "class2",
SortText: PtrTo(string(ls.SortTextJavascriptIdentifiers)),
},
&lsproto.CompletionItem{
Label: "constructor",
SortText: PtrTo(string(ls.SortTextJavascriptIdentifiers)),
},
&lsproto.CompletionItem{
Label: "inst2",
SortText: PtrTo(string(ls.SortTextJavascriptIdentifiers)),
},
&lsproto.CompletionItem{
Label: "instance",
SortText: PtrTo(string(ls.SortTextJavascriptIdentifiers)),
},
&lsproto.CompletionItem{
Label: "prototype",
SortText: PtrTo(string(ls.SortTextJavascriptIdentifiers)),
},
&lsproto.CompletionItem{
Label: "TestObj",
SortText: PtrTo(string(ls.SortTextJavascriptIdentifiers)),
},
},
},
})
f.Backspace(t, 1)
f.GoToMarker(t, "b")
f.VerifyQuickInfoIs(t, "(method) class2.blah(): void", "")
}