RBCodeSnippet format, tidify and better default mechanism #13109
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.
This is a simple (but important) cleanup of the code snippet definitions.
RBCodeSnippet was introduced to help to test a lot of piece of codes on a lot of code processing and tools (thanks to matrix testing). There are more than 4700 (green) tests right now; something that could not scale if wrote by hand.
Especially, it helped me to prevent numerous breakages when dealing with compiler work.
Currently, expected results on snippets are quite limited: is there a syntax error? what is the value if I execute it? etc.
Therefore, if RBCodeSnippet become larger with more snippets and more kind of tests (thus more expected results to fill), it will also start to have scaling issues: how to add new expected results on numerous existing snippets, and how to add new snippets and declare the expected results of numerous tests. It's the problem of matrix testing, you have somehow to have a way to declare (or to compute) the value of each individual cells.
So this PR does 3 things:
While I do not appreciate the format style that much, it will be less difficult to maintain in the long term.
In fact, it was already done by hand, but not it's simpler, cleaner, and more powerful.
The full diff is huge because of reformatting, but it is isolated in the first commit, so other commits are shorter and simpler.