// Code generated by convertFourslash; DO NOT EDIT. // To modify this test, run "npm run makemanual genericsFormatting" package fourslash_test import ( "testing" "github.com/microsoft/typescript-go/internal/fourslash" "github.com/microsoft/typescript-go/internal/testutil" ) func TestGenericsFormatting(t *testing.T) { fourslash.SkipIfFailing(t) t.Parallel() defer testutil.RecoverAndFail(t, "Panic on fourslash test") const content = `/*inClassDeclaration*/class Foo < T1 , T2 > { /*inMethodDeclaration*/ public method < T3, T4 > ( a: T1, b: Array < T4 > ): Map < T1 , T2, Array < T3 > > { } } /*typeArguments*/var foo = new Foo < number, Array < number > > ( ); /*typeArgumentsWithTypeLiterals*/foo = new Foo < { bar : number }, Array < { baz : string } > > ( ); interface IFoo { /*inNewSignature*/new < T > ( a: T); /*inOptionalMethodSignature*/op?< T , M > (a: T, b : M ); } foo()(); (a + b)(); /*inFunctionDeclaration*/function bar () { /*inClassExpression*/ return class < T2 > { } } /*expressionWithTypeArguments*/class A < T > extends bar < T >( ) < T > { }` f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) defer done() f.FormatDocument(t, "") f.GoToMarker(t, "inClassDeclaration") f.VerifyCurrentLineContent(t, `class Foo {`) f.GoToMarker(t, "inMethodDeclaration") f.VerifyCurrentLineContent(t, ` public method(a: T1, b: Array): Map> {`) f.GoToMarker(t, "typeArguments") f.VerifyCurrentLineContent(t, `var foo = new Foo>();`) f.GoToMarker(t, "typeArgumentsWithTypeLiterals") f.VerifyCurrentLineContent(t, `foo = new Foo<{ bar: number }, Array<{ baz: string }>>();`) f.GoToMarker(t, "inNewSignature") f.VerifyCurrentLineContent(t, ` new (a: T);`) f.GoToMarker(t, "inOptionalMethodSignature") f.VerifyCurrentLineContent(t, ` op?(a: T, b: M);`) f.GoToMarker(t, "inFunctionDeclaration") f.VerifyCurrentLineContent(t, `function bar() {`) f.GoToMarker(t, "inClassExpression") f.VerifyCurrentLineContent(t, ` return class {`) f.GoToMarker(t, "expressionWithTypeArguments") f.VerifyCurrentLineContent(t, `class A extends bar() {`) }