Optionally reduce test transcript verbosity with {include:silent} - #29
Open
stormi wants to merge 3 commits into
Open
Optionally reduce test transcript verbosity with {include:silent}#29stormi wants to merge 3 commits into
stormi wants to merge 3 commits into
Conversation
Add support for including another test file at a point in the current test file with ** include: file.t The included file is parsed recursively — its tests, directives, and nested includes take effect as if pasted inline at the ** include: line. Paths are resolved relative to the including file's directory. Multiple ** include: lines are needed to include several files; each line includes exactly one file. - Circular include chains are detected and raise an error with the full cycle path (e.g. A -> B -> C -> A) - Duplicate test names across files raise an error showing both source files - All directives follow the same rules: ** game: overrides, ** precommand: appends, etc.
>{include:silent} TESTNAME runs the included test's commands as usual but
keeps their output out of the verbose transcript, in order to avoid repetition
in the test transcripts.
The included test's checks still run, and their failures are still reported.
Pass -vv to see everything anyway.
In -v mode a marker line, [silently included: TESTNAME], is printed in
place of the hidden block, so the transcript still shows where the
included test ran.
Signed-off-by: Samuel Verschelde <stormi-git@ylix.fr>
When the first thing a test does is silenced, whatever runs before it is
setup you have already seen too: the game's initial output, and any
precommands ahead of it. Those are now hidden as well, so the transcript
of each test begins where the test itself does.
A test starts silently when its first command is >{include:silent}, when
it plainly includes a wrapper test which itself starts silently, or when
the silent include is a precommand, in which case it is the first thing
every test in the file does.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 PR is stacked on top of #27 to avoid merge conflicts. Thus, ignore the first commit during the review.
Almost all my tests begin with >{include} (directly or via a precommand), which comes with an enormous amount of setup commands and output in verbose mode, drowning the useful test output under tons of repeated output.
To solve this, I have added support for adding
:silentto the{include}command. This replaces the output (commands + game output) with just one line such as:[silently included: _to_chambre]. The full output is however displayed with-vv. The checks in silenced tests are still executed.This is what the second commit is about.
After this change, I also noticed that I still had the initial output of the game in the test output. So, assuming that someone using silent include would want this, when the first command in a test is a silenced command, the game startup is also automatically silenced (third commit).
I've been using this for a few days and this is really useful to me in my workflow, where I review and store transcripts resulting from the execution of the tests, so that we may detect any unexpected changes in them, even for strings that are not directly tested with regtest's checks.