winnow-rs / winnow

Making parsing a breeze
https://docs.rs/winnow
Other
525 stars 40 forks source link

test failures in v0.6.1 when running in release mode #478

Closed decathorpe closed 7 months ago

decathorpe commented 7 months ago

I'm responsible for packaging the winnow crate for Fedora Linux, and I'm working on updating it to the latest version (since toml_edit now depends on it). I noticed new test failures compared to v0.5.40:

failures:

---- combinator::tests::fold_repeat0_empty_test stdout ----
thread 'combinator::tests::fold_repeat0_empty_test' panicked at src/combinator/tests.rs:1247:5:
assertion `left == right` failed
  left: Err(Cut(InputError { input: Partial { input: [97, 98, 99, 100, 101, 102], partial: true }, kind: Assert }))
 right: Err(Backtrack(InputError { input: Partial { input: [97, 98, 99, 100, 101, 102], partial: true }, kind: Assert }))
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

---- combinator::tests::repeat0_empty_test stdout ----
thread 'combinator::tests::repeat0_empty_test' panicked at src/combinator/tests.rs:923:5:
assertion `left == right` failed
  left: Err(Cut(InputError { input: Partial { input: [97, 98, 99, 100, 101, 102], partial: true }, kind: Assert }))
 right: Err(Backtrack(InputError { input: Partial { input: [97, 98, 99, 100, 101, 102], partial: true }, kind: Assert }))

---- combinator::tests::separated0_empty_sep_test stdout ----
thread 'combinator::tests::separated0_empty_sep_test' panicked at src/combinator/tests.rs:782:5:
assertion `left == right` failed
  left: Err(Cut(InputError { input: Partial { input: [97, 98, 99], partial: true }, kind: Assert }))
 right: Err(Backtrack(InputError { input: Partial { input: [97, 98, 99], partial: true }, kind: Assert }))

failures:
    combinator::tests::fold_repeat0_empty_test
    combinator::tests::repeat0_empty_test
    combinator::tests::separated0_empty_sep_test

test result: FAILED. 215 passed; 3 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

error: test failed, to rerun pass `--lib`

We run builds / tests with the same cargo / rustc flags that we use for building applications (a profile based on the release profile, i.e. without debug assertions). I noticed that all three of these tests are annotated with #[cfg_attr(debug_assertions, should_panic)] so this might be relevant - does this mean these tests should pass in release mode?

epage commented 7 months ago

They were written to pass but we don't run tests in release mode, only verify compilation.

decathorpe commented 7 months ago

Awesome, thanks for the quick fix!