RuleTestCase: enable gathering analyser errors without assert #1728
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.
I want to propose extracting the part of
RuleTestCase::analysethat gathers the actual errors into its own public method so that the child test can do the comparison in a different way when necessary.The use-case I have for this is that I want to use golden tests (i.e. gather the errors once, save them into a file, check them manually and then test against this saved sample in the future) instead of writing down the expected errors manually. This should make it possible to change the error messages easily, as well as edit the analysed file without having to worry about line numbers etc.
Unfortunately, the current interface of the
RuleTestCasedoes not allow me to do this easily. For now, I'm using this workaround but as I'm relying on things not covered by BC promise, it could break easily in the future.