-
Notifications
You must be signed in to change notification settings - Fork 664
Adding manual tests list #1446
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
Open
navya9singh
wants to merge
5
commits into
microsoft:main
Choose a base branch
from
navya9singh:manualTests
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+13,548
−8
Open
Adding manual tests list #1446
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
892b4a3
adding manual tests list
navya9singh 58e0833
addressing copilot comments
navya9singh a315af7
Merge branch 'main' of https://github.com/navya9singh/typescript-go-r…
navya9singh 15932de
slight tweak to scripts, add one manual case
gabritto ebe23ba
Merge branch 'main' into manualTests
gabritto File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import * as fs from "fs"; | ||
import * as path from "path"; | ||
|
||
const scriptsDir = import.meta.dirname; | ||
const manualTestsPath = path.join(scriptsDir, "manualTests.txt"); | ||
const genDir = path.join(scriptsDir, "../", "tests", "gen"); | ||
const manualDir = path.join(scriptsDir, "../", "tests", "manual"); | ||
|
||
function main() { | ||
const args = process.argv.slice(2); | ||
|
||
if (args.length === 0) { | ||
console.error("Please provide the name of the generated test file."); | ||
process.exit(1); | ||
} | ||
|
||
const testName = args[0]; | ||
const testFileName = testName; | ||
const genTestFile = path.join(genDir, testFileName + "_test.go"); | ||
if (!fs.existsSync(genTestFile)) { | ||
console.error(`Test file not found: '${genTestFile}'. Make sure the test exists in the gen directory first.`); | ||
process.exit(1); | ||
} | ||
|
||
if (!fs.existsSync(manualDir)) { | ||
fs.mkdirSync(manualDir, { recursive: true }); | ||
} | ||
|
||
const manualTestFile = path.join(manualDir, path.basename(genTestFile)); | ||
renameAndRemoveSkip(genTestFile, manualTestFile); | ||
|
||
let manualTests: string[] = []; | ||
if (fs.existsSync(manualTestsPath)) { | ||
const content = fs.readFileSync(manualTestsPath, "utf-8"); | ||
manualTests = content.split("\n").map(line => line.trim()).filter(line => line.length > 0); | ||
} | ||
|
||
if (!manualTests.includes(testName)) { | ||
manualTests.push(testName); | ||
manualTests.sort(); | ||
fs.writeFileSync(manualTestsPath, [...manualTests, ""].join("\n"), "utf-8"); | ||
} | ||
} | ||
|
||
function renameAndRemoveSkip(genFilePath: string, manualFilePath: string) { | ||
const content = fs.readFileSync(genFilePath, "utf-8"); | ||
const updatedContent = content.replace(/^\s*t\.Skip\(\)\s*$/m, ""); | ||
fs.writeFileSync(manualFilePath, updatedContent, "utf-8"); | ||
fs.rmSync(genFilePath); | ||
} | ||
|
||
main(); |
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 @@ | ||
completionListInClosedFunction05 |
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
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.
Maybe a silly question but why can't we generate this one automatically?
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.
There's no simplified way to compute what the commit characters should be other than the actual implementation. The porting script currently sets empty commit characters if
isNewIdentifierLocation
is true, which is an approximation that does not always hold, like in this test. An alternative would be to ignore commit characters for all ported tests, but I didn't want to do that and end up with no coverage of it.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.
Would it be simpler to just keep a list of these in the generator script?
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.
For this case, probably, but there are other tests that need other types of manual fixes, and tests that will need to be at least partially manually ported because they have things like for loops and functions.