dtolnay / trybuild

Test harness for ui tests of compiler diagnostics
Apache License 2.0
779 stars 64 forks source link

Runner panics after testing for compile fail on tests with a module. #286

Closed wtfamidoingrn closed 3 hours ago

wtfamidoingrn commented 3 hours ago

When running any compile fail test that contains a module definition, e.g.

mod Foo{}

fn main() {}

, trybuild panics after executing all test cases. This is not affected by the test actually succeeding to compile or not. This does not happen when the test is supposed to pass.

The resulting output is

test tests/trybuild/panics.rs ... error
Expected test case to fail to compile, but it succeeded.

test test ... FAILED

failures:

---- test stdout ----
thread 'test' panicked at /home/jmichel/.cargo/registry/src/index.crates.io-6f17d22bba15001f/trybuild-1.0.99/src/run.rs:101:13:
1 of 1 tests failed
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

failures:
    test

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.09s
wtfamidoingrn commented 3 hours ago

Or is the panic just expected behaviour to make the test fail for the perspective of cargo and I am too stupid to use trybuild correctly? I'm currently struggling to replicate this in an empty project. When I set the expected output for the compile fail, this does not happen.

wtfamidoingrn commented 3 hours ago

Yeah, this seems to be just my own incompetence and not overwriting the .stderr files after changing tests...