-
Notifications
You must be signed in to change notification settings - Fork 646
Conversation
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.
@MagnumOpus21 Thanks for the PR. I believe there has been some misunderstanding on the issue that we are trying to fix here.
Below is a picture of your second case.
The text rounded up in red is the bug. When you run the test in the terminal, you get the timestamp followed by the file details. This line should not be picked up by expandFilePathInOutput
Only lines in the output that correspond to actual test failure should be picked up by expandFilePathInOutput
Ah my bad. I thought the "prepended" by --- FAIL : was a mistake. I shall rectify this in the following commit. |
src/testUtils.ts
Outdated
@@ -340,7 +340,7 @@ export function cancelRunningTests(): Thenable<boolean> { | |||
function expandFilePathInOutput(output: string, cwd: string): string { | |||
let lines = output.split('\n'); | |||
for (let i = 0; i < lines.length; i++) { | |||
let matches = lines[i].match(/^\s*(.+.go):(\d+):/); | |||
let matches = lines[i].match(/^\s*(\s*\w+.go):(\d+):/); |
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.
Why do we want to capture the spaces here? Is this to cater to the case when the file name contains a space?
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.
I thought spaces might be present at the beginning of the file. This has another bug, where if we have spaces in the filename like file name.go
the regex will fail to pick this. Another commit inc.
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.
Add a compile error in your code and then run the test. The test output will now show the build error in the below format:
.\reverse_test.go:23:12: undefined: sring
Now, with the current change, the above will not get expanded because \w
will not match .\
@MagnumOpus21 Are you sure the last commit makes a difference? File names with spaces would have worked even without that commit as far as I understand. Since that is a very corner case, I am ok not supporting the scenario where file name has spaces. |
The GitHub outage prevented me from viewing your previous message with the regex for the build errors. I could see your why not this regex suggestion earlier in the day, now I am not able to spot it at all. Still am not sure if I can see all the suggestions after the outage started on outdated thread 😅. |
@ramya-rao-a Now it should capture all the failures on non-Windows platforms as well. I was just testing the extension on Windows. 😓 |
src/testUtils.ts
Outdated
@@ -340,7 +340,7 @@ export function cancelRunningTests(): Thenable<boolean> { | |||
function expandFilePathInOutput(output: string, cwd: string): string { | |||
let lines = output.split('\n'); | |||
for (let i = 0; i < lines.length; i++) { | |||
let matches = lines[i].match(/^\s*(.+.go):(\d+):/); | |||
let matches = lines[i].match(/^\s*([(\.\/)?\w+\s*]+.go):(\d+):/); |
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.
Things inside the []
dont need the quantifiers like ?
, +
or *
. []
defines the allowed characters not their quantity or order.
Also, this will not work for Windows.
Can you make this an exported function and add some tests to cover the different scenarios?
You can add the tests in https://github.com/Microsoft/vscode-go/blob/master/test/unit/utils.test.ts
Sorry for the no progress during the past weeks. Hectic school session in progress. I will finish the PR during Thanksgiving week. Thanks for your patience. |
No problem @MagnumOpus21, take your time. |
@MagnumOpus21 did you see my comment in the original issue (#1836) by any chance? |
I'm sorry 😔. I was busy with school. I'll take a look at this and finish this fast. It's been far too long. Apologize for the lateness @peergynt |
@ramya-rao-a Do I have to do anything to get the Go Extension tests to pass for go1.11. It passes for the other versions of golang on Travis. |
Hey @MagnumOpus21 My apologies for not getting to this sooner I tried a few more cases with the code in this PR
I am starting to feel that we are getting into risky areas by trying to cater to extract the right relative path that needs to be expanded. We know what the expanded path needs to look like because we have access to Thoughts? |
Hey @MagnumOpus21 Since working with regexes still left some corner cases not covered, I've decided to take a different approach here. Please see #1836 (comment) Thanks for all the work here & Happy Coding! |
Fixes #1836.
![pass_golang](https://user-images.githubusercontent.com/5468110/47190702-f3eaf800-d310-11e8-90fa-97c0d4cec83d.png)
![fails_golang](https://user-images.githubusercontent.com/5468110/47190703-f3eaf800-d310-11e8-9824-0a4d9db43580.png)
.
@ramya-rao-a
These are the images I get after making the modifications.
This image is that of a passing test case.
This image is for a failing test case.
This is for one passing case and one failing case. (Package wide)
I have tested this with all the options from the command palette.
Do tell me if I need to add more to the PR, to make it even better :)