-
Notifications
You must be signed in to change notification settings - Fork 662
Port go-to-definition baseline tests #1437
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
af52007
Add `VerifyBaselineGoToDefinition` to fourslash.
DanielRosenwasser 7928f6c
Start supporting `baselineGetDefinitionAtPosition`.
DanielRosenwasser 39180b7
Generate new fourslash tests.
DanielRosenwasser 2766eb7
Accept baselines.
DanielRosenwasser 971d423
Always include files with a source marker in baselines.
DanielRosenwasser b7fed23
Accept go-to-definition baselines.
DanielRosenwasser ef6e179
Accept find-all-references baselines.
DanielRosenwasser a356daa
Recognize `baselineGoToDefinition` fourslash tests.
DanielRosenwasser ce37d32
Add new converted fourslash tests.
DanielRosenwasser 030fc9e
Accept baselines.
DanielRosenwasser 31e6eab
Update failing tests.
DanielRosenwasser 8e4c352
Format.
DanielRosenwasser f36516d
Add `nil` check for go-to-definition results.
DanielRosenwasser cf22a3b
Update previously-failing fourslash tests.
DanielRosenwasser d4e0c95
Accept baselines.
DanielRosenwasser 390281e
Partially port `foundMarker` - print marker file at the end if not pr…
DanielRosenwasser eae6f2a
Accept baselines.
DanielRosenwasser fbc9072
Newline looks weird now.
DanielRosenwasser dd06b53
Removed unused baseline.
DanielRosenwasser 02eca5a
Merge branch 'main' into supportGoToDefBaselines
DanielRosenwasser File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
internal/fourslash/tests/gen/declarationMapGoToDefinition_test.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package fourslash_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/microsoft/typescript-go/internal/fourslash" | ||
"github.com/microsoft/typescript-go/internal/testutil" | ||
) | ||
|
||
func TestDeclarationMapGoToDefinition(t *testing.T) { | ||
t.Parallel() | ||
|
||
defer testutil.RecoverAndFail(t, "Panic on fourslash test") | ||
const content = `// @Filename: index.ts | ||
export class Foo { | ||
member: string; | ||
/*2*/methodName(propName: SomeType): void {} | ||
otherMethod() { | ||
if (Math.random() > 0.5) { | ||
return {x: 42}; | ||
} | ||
return {y: "yes"}; | ||
} | ||
} | ||
export interface SomeType { | ||
member: number; | ||
} | ||
// @Filename: indexdef.d.ts.map | ||
{"version":3,"file":"indexdef.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA;IACI,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI;IACpC,WAAW;;;;;;;CAMd;AAED,MAAM,WAAW,QAAQ;IACrB,MAAM,EAAE,MAAM,CAAC;CAClB"} | ||
// @Filename: indexdef.d.ts | ||
export declare class Foo { | ||
member: string; | ||
methodName(propName: SomeType): void; | ||
otherMethod(): { | ||
x: number; | ||
y?: undefined; | ||
} | { | ||
y: string; | ||
x?: undefined; | ||
}; | ||
} | ||
export interface SomeType { | ||
member: number; | ||
} | ||
//# sourceMappingURL=indexdef.d.ts.map | ||
// @Filename: mymodule.ts | ||
import * as mod from "./indexdef"; | ||
const instance = new mod.Foo(); | ||
instance.[|/*1*/methodName|]({member: 12});` | ||
f := fourslash.NewFourslash(t, nil /*capabilities*/, content) | ||
f.VerifyBaselineGoToDefinition(t, "1") | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This marker is different from both of the ones we have in Strada. Open to adopting one over the other.