Closed reubent closed 6 years ago
@reubent Thanks you for your contribution !
Thanks @reubent for your contrib. It will probably fix some issues for other users of the plugin too (e.g. #49).
Would it be possible to make your PR against the maintenance branch instead of master?
The maintenance branch contains the 1.2.X releases code while the master branch contains code for the next major release.
It would be nice too if you could prevent pom.xml to be changed in the PR :).
Hi @reubent @danielleberre It looks like this PR breaks the bug I fixed in https://github.com/uartois/sonar-golang/pull/27 . Please take a look in the above link for the detailed explanation. Also please make sure the new tests covers all the existing tests. As far as I can tell the tests for people who use testSuite have been removed.
Thanks @Tvli for pointing that out. I guess that we could add the following test sample to test_test.go to make sure that the proposed REGEXP also works for you?
func (suite *ExampleTestSuite) TestExample() {
suite.Equal(5, suite.VariableThatShouldStartAtFive)
}
I resolved the conflicts in reubent-fix_test_parsing branch.
Please check that everything is fine (we may want to create a new PR from that branch).
@Tvli your test case has been added in the file test_test.go, and the test case now breaks. So we can improve the PR with your specific testcase.
@thibaultfalque the build is successful while there are failing test cases, as such the CI is not very useful right now for PR ...
Hey @danielleberre
The test case looks good to me. Thanks 👍
@Tvli I updated the REGEXP in a282eeec91dd87d3da5687c2d12d0f8d4a5cac3e to match your specific needs. I assume that testsuite always start with (suite
, is that correct?
Hi @danielleberre No it's not. In Go lang , the syntax for a struct instance method is
func (alias struct) methodName() {}
To be more exact:
type A struct {
Val string
}
func (whateverIWant A) printVal() {
print(whateverIwant.Val)
}
so the "suite" can be any alias people want to use to represent the struct within the function's scope.
I guess you probably want to find the Test function name after the first )
.
@Tvli Thanks for the explanation. I added a new test case and fixed now properly the REGEXP.
I didn't actually mean to submit this - force of habit creating pull requests after pushing kicked in. This was written for our own internal use but feel free to use if it is helpful. It works around a number of issues we were having with parsing of test files.