vendor tsgo
This commit is contained in:
@@ -0,0 +1,91 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual thisPredicateFunctionCompletions03"
|
||||
|
||||
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 TestThisPredicateFunctionCompletions03(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `class RoyalGuard {
|
||||
isLeader(): this is LeadGuard {
|
||||
return this instanceof LeadGuard;
|
||||
}
|
||||
isFollower(): this is FollowerGuard {
|
||||
return this instanceof FollowerGuard;
|
||||
}
|
||||
}
|
||||
|
||||
class LeadGuard extends RoyalGuard {
|
||||
lead(): void {};
|
||||
}
|
||||
|
||||
class FollowerGuard extends RoyalGuard {
|
||||
follow(): void {};
|
||||
}
|
||||
|
||||
let a: RoyalGuard = new FollowerGuard();
|
||||
if (a.is/*1*/Leader()) {
|
||||
a./*2*/;
|
||||
}
|
||||
else if (a.is/*3*/Follower()) {
|
||||
a./*4*/;
|
||||
}
|
||||
|
||||
interface GuardInterface {
|
||||
isLeader(): this is LeadGuard;
|
||||
isFollower(): this is FollowerGuard;
|
||||
}
|
||||
|
||||
let b: GuardInterface;
|
||||
if (b.is/*5*/Leader()) {
|
||||
b./*6*/;
|
||||
}
|
||||
else if (b.is/*7*/Follower()) {
|
||||
b./*8*/;
|
||||
}
|
||||
|
||||
let leader/*13*/Status = a.isLeader();
|
||||
function isLeaderGuard(g: RoyalGuard) {
|
||||
return g.isLeader();
|
||||
}
|
||||
let checked/*14*/LeaderStatus = isLeader/*15*/Guard(a);`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.VerifyCompletions(t, []string{"2", "6"}, &fourslash.CompletionsExpectedList{
|
||||
IsIncomplete: false,
|
||||
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
|
||||
CommitCharacters: &DefaultCommitCharacters,
|
||||
EditRange: Ignored,
|
||||
},
|
||||
Items: &fourslash.CompletionsExpectedItems{
|
||||
Unsorted: []fourslash.CompletionsExpectedItem{
|
||||
"lead",
|
||||
"isLeader",
|
||||
"isFollower",
|
||||
},
|
||||
},
|
||||
})
|
||||
f.VerifyCompletions(t, []string{"4", "8"}, &fourslash.CompletionsExpectedList{
|
||||
IsIncomplete: false,
|
||||
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
|
||||
CommitCharacters: &DefaultCommitCharacters,
|
||||
EditRange: Ignored,
|
||||
},
|
||||
Items: &fourslash.CompletionsExpectedItems{
|
||||
Unsorted: []fourslash.CompletionsExpectedItem{
|
||||
"follow",
|
||||
"isLeader",
|
||||
"isFollower",
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user