miette icon indicating copy to clipboard operation
miette copied to clipboard

Tests in README failing without fancy feature

Open LordMZTE opened this issue 3 years ago • 1 comments

When running cargo test without --features fancy, one of the tests in README.md fails:

failures:

---- src/lib.rs - (line 386) stdout ----
error[E0433]: failed to resolve: could not find `MietteHandlerOpts` in `miette`
 --> src/lib.rs:388:22
  |
5 |     Box::new(miette::MietteHandlerOpts::new()
  |                      ^^^^^^^^^^^^^^^^^ could not find `MietteHandlerOpts` in `miette`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0433`.
Couldn't compile the test.

failures:
    src/lib.rs - (line 386)

test result: FAILED. 26 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.86s

error: test failed, to rerun pass '--doc'

The error is a little confusing due to the include_str! used in lib.rs, but it's caused by line 388 in README.md. Looks like the code is referencing a struct that exists only with the fancy feature. Maybe we should add a cfg attribute to the example function? We should also consider adding a step to the CI that runs tests without the fancy feature.

I can also open a PR to fix this :D

LordMZTE avatar Oct 15 '21 21:10 LordMZTE

PR Welcome. I don't actually know how to fix this without changing the test (the test should display the same).

zkat avatar Oct 15 '21 22:10 zkat