- Update the fm dependency, which has breaking changes, as well as several new features.
- Sort test failures by name rather than the previous arbitrary order.
-
Use newer version of fm that provides more comprehensive output by default.
-
Document and enforce that
ignore-if
cmds are run inCARGO_MANIFEST_DIR
.
- Remove
ignored
and addignore-if
. The latter runs an arbitrary shell command which, if it returns zero, causes the test to be ignored. This allows much more flexibility than the overly simplistic "always ignore this test" ofignored
. Tests withignored: <reason>
can be changed toignore-if: true
followed (or preceded) by a comment# <reason>
(assumingcomment_prefix
is set: see below).
- Allow comments in tests with a user-configurable prefix. By default no
comment prefix is set. You can set one with
comment_prefix("...")
. For exampleLangTester::new().comment_prefix("#")
causes lines in tests starting with#
to be entirely ignored by lang_tester.
test_file_filter
is deprecated in favour oftest_path_filter
. The latter doesn't pre-filter non-files, making it more flexible. A simple way of moving fromtest_file_filter
totest_path_filter
is to changetest_file_filter(|p| ...)
totest_path_fiter(|p| p.is_file() & ...)
.
- Make the library documentation (rather than the README) the source of documentation truth.
- Allow test filtering on the full test name (e.g.
lang_tests::a::b::c
) rather than just the leaf (e.gc
).
- Add support for rerun-if-{status, stderr, stdout}.
- Fix poll() loop, so the full output of a subcommand is now read properly.
- Show a test as failing if
FMBuilder
throws an error.
- The
extra-args
key has been renamed toexec-arg
to reflect the fact that each key is a single argument.
- The
env-var
key has been added. This allows environment variables to be set on a per-test basis e.g.:
Compiler:
env-var: DEBUG=1
stdout: xyz
-
Fix file descriptor race for tests that contain stdin data: files were closed twice, which could lead to an active (reused) file descriptor being closed incorrectly.
-
Documentation fixes.
- Fix test file filtering.
- If a function passed by the user to the user (e.g. to
test_extract
)panic
s,lang_tester
now considers that a test failure and reports it to the user. Because this usescatch_unwind
underneath, the functions passed tolang_tester
must now beRefUnwindSafe
.
-
The
test_extract
function signature has changed from:Fn(&str) -> Option<String> + Send + Sync,
to:
Fn(&Path) -> String + Send + Sync,
In other words, users now have to both:
- read the contents of a path themselves (but it doesn't necessarily have to be the path passed to the function!),
- and return a
String
rather than anOption<String>
.
In practise, most
test_extract
functions can be changed from (roughly):test_extract(|s| { s.lines() ... })
to:
test_extract(|p| { std::fs::read_to_string(p).lines() })
- Update to fm 0.2.0. This changes the interface exposed by the
fm_options
function. See thefm
changes for more information.
- Silence some Clippy warnings and fix documentation inconsistencies.
- Failed stderr/stdout tests now use fm to show the offending line and up to 3 lines of surrounding context. This makes it much easier to understand why a stderr/test failed.
-
Remove the built-in fuzzy matcher and use the
fm
library instead. This should be entirely backwards compatible in its default state. Users who want non-defaultfm
options can use the newfm_options
function inLangTester
. -
Add a
stdin
key to allow users to specify stdin input which should be passed to a sub-command. -
Lines are no longer stripped of their leading or trailing whitespace allowing tests to be whitespace sensitive if required. Since matching in
fm
defaults to ignoring leading and trailing whitespace, the previous behaviour is preserved unless users explicitly tellfm
to match whitespace.
- Print out the name of tests inside nested directories rather than flattening
them all such that they appear to be the top-level directory. If you have
tests
a/x
andb/x
these are pretty printed asa::x
andb::x
respectively (whereas before they were pretty printed as simplyx
, meaning that you could not tell which had succeeded / failed).
-
Add
test_threads
function which allows you to specify the number of test threads programatically. -
Move from the deprecated
tempdir
to the maintainedtempfile
crate.
- Fix bug on OS X where input from sub-processes blocked forever.
-
Add support for ignorable tests. A test command
ignore:
is interpreted as causing that entire test file to be ignored. As withcargo test
, such tests can be run with the--ignored
switch. -
Fix a bug whereby the number of ignored tests was incorrectly reported.
- License as dual Apache-2.0/MIT (instead of a more complex, and little understood, triple license of Apache-2.0/MIT/UPL-1.0).
- Add support for programs which terminated due to a signal. Users can now
specify
status: signal
to indicate that a test should exit due to a signal: on platforms which do not support this (e.g. Windows), such tests are ignored. Similarly, if a program was terminated due to a signal then, on Unix, the user is informed of that after test failure.
-
Add support for
--nocapture
to better emulatecargo test
. As withcargo test
, if you're running more than one test then--nocapture
is generally best paired with--test-threads=1
to avoid confusing, multiplexed output to the terminal. -
Be clearer that tests can have defaults: notably commands default to
status: success
unless overridden.
-
Individual tests can now add extra arguments to an invoked command with the
extra-args
field. -
Ensure that, if a command in a chain fails, the whole chain of commands fails. This means that if, for example, compilation of command C fails, we do not try and run C anyway (which can end up doing confusing things like running an old version of C).
- Fixed bug where potentially multi-line keys with empty values were not always parsed correctly.
-
Add support for running a defined number of parallel processes, using the
cargo test
-ish option--test-threads=n
. For example, to run tests sequentially, specify--test-threads=1
. -
Warn users if a given test has run unexpectedly long (currently every multiple of 60 seconds). This is often a sign that a test has entered an infinite loop.
-
Use better terminology in the documentation. Previously "test" was used to mean a number of subtly different things which was rather confusing. Now test files contain test data. Test data contains test commands. Test commands contain sub-tests.
-
Stop testing a given test file on the first failed sub-test. Previously only a test command which exited unsuccessfully caused a test file to be considered as failed, causing the source of errors to sometimes be missed.
- The
test_extract
andtest_cmds
functions must now satisfy theSync
trait. This is a breaking change, albeit one that nearly all such functions already satisfied.
- When a test fails, report to the user both the parts of the test that failed and the parts that weren't specified. For example, if a test merely checks that a command runs successfully, we now report stdout and stderr output to the user, so that they can better understand what happened.
- Fatal errors (e.g. an inability to run a command, or an error in the way a user has specified a test, such as a syntax error) now cause the process to exit (whereas before they merely caused the thread erroring to panic, leading to errors being lost in the noise).
-
Accept cargo-ish command-line parameters. In particular, this lets users run a subset of tests e.g. " ab cd" only runs tests with "ab" or "cd" in their name. If you don't want
lang_tester
to look at your command-line arguments, setuse_cmdline_args(false)
(the default istrue
). -
Run tests in parallel (one per CPU core). Depending on the size of your machine and the size of your test suite, this can be a significant performance improvement.
-
The
status
field can now take integer exit codes. i.e. if you specifystatus: 7
then the exit code of the binary being run will be checked to see if it is 7.
First stable release.