Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libtest-mimic test failure not recognised #836

Closed
niluxv opened this issue Mar 20, 2023 · 6 comments
Closed

libtest-mimic test failure not recognised #836

niluxv opened this issue Mar 20, 2023 · 6 comments
Labels
question Further information is requested

Comments

@niluxv
Copy link

niluxv commented Mar 20, 2023

I'm using a custom test harness using libtest-mimic (version 0.6.0), but when one of those tests fails, cargo nextest run still reports it as passed.

@sunshowers
Copy link
Member

Hi there, thanks for the report! I don't seem to be able to reproduce this issue with datatest-stable, with:

  • keeping libtest-mimic at 0.5.2 or bumping it to 0.6.0
  • putting in a panic!
  • returning Err(something)

Could you provide a minimal reproducible example?

@sunshowers sunshowers added the question Further information is requested label Mar 20, 2023
@niluxv
Copy link
Author

niluxv commented Mar 20, 2023

Hm, it seems to require using Trial::with_kind.

Example:

use libtest_mimic::{Arguments, Failed, Trial};

fn main() -> anyhow::Result<()> {
    let args = Arguments::from_args();
    let tests = vec![
        Trial::test("example.txt", erroring_test).with_kind("parse")
    ];
    libtest_mimic::run(&args, tests).exit();
}

fn erroring_test() -> Result<(), Failed> {
    // either return error or panic!, cargo nextest will still show as `PASS`
    //panic!();
    Err("Error, this doesn't work".into())
}

@sunshowers
Copy link
Member

Ah thanks for the extended report. This is a bug in libtest-mimic.

@sunshowers
Copy link
Member

I've proposed LukasKalbertodt/libtest-mimic#30 in libtest-mimic which will fix this. For now, please avoid using with_kind.

@niluxv
Copy link
Author

niluxv commented Apr 8, 2023

Thank you for looking into this!

@sunshowers
Copy link
Member

This should be fixed with a libtest-mimic update. Thanks for the report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants