golden-tests
golden-tests copied to clipboard
Add warning if no test commands were found within a test file
From an idea in #3 - if no test commands were found within a file this is usually indicative of the user giving the wrong test prefix. For example, a user could use the test prefix "//"
and include // args: foo
in their file, only for goldentests to fail to find any commands due to the space being present between the test prefix and the args keyword. It is possible that by closely looking at the examples, a user can find that they should add a space to the test prefix: "// "
but a hint would go a long way towards making the crate easier to use. Such a warning can be issued if no test commands were successfully parsed. Previously this was a valid case - ensuring the test produces no input, output, exits with a status of 0, and requires no extra arguments to run. This case could still be supported after the warning is implemented by including the args, expected stdout, or expected stderr keywords with an empty string, e.g. // expected stdout:
.