Files
tsgo/internal/fourslash/tests/decoratorOnPrivateMethod_test.go
865c8d0ffb Fix panic in getClassElementPropertyKeyType for private identifiers (#3819)
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: RyanCavanaugh <[email protected]>
Co-authored-by: Gabriela Araujo Britto <[email protected]>
Co-authored-by: Gabriela Araujo Britto <[email protected]>
2026-05-27 17:56:20 +00:00

37 lines
1.0 KiB
Go

package fourslash_test
import (
"testing"
"github.com/microsoft/typescript-go/internal/fourslash"
. "github.com/microsoft/typescript-go/internal/fourslash/tests/util"
"github.com/microsoft/typescript-go/internal/testutil"
)
func TestDecoratorCompletionOnPrivateMethod(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `
// @experimentalDecorators: true
declare function dec(target: any, key: string): void;
class C {
@dec/**/
#method() {}
}`
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
defer done()
// Verify completions don't panic on decorator applied to private method
f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{
Includes: []fourslash.CompletionsExpectedItem{
"dec",
},
},
})
}