Skip to content

Allow later globs to override pass/fail status of earlier globs #174

Closed
@dtolnay

Description

@dtolnay

For example the following setup:

// test/compiletest.rs

#[test]
fn ui() {
    let t = trybuild::TestCases::new();
    t.compile_fail("tests/ui/*.rs");
    t.pass("tests/ui/ok.rs");
}
// tests/ui/fail.rs

fn main() {
    let;
}
// tests/ui/ok.rs

fn main() {}

Currently trybuild would build ok.rs twice, expecting it to both pass and fail, which is nonsensical.

test tests/ui/fail.rs [should fail to compile] ... wip

NOTE: writing the following output to `wip/fail.stderr`.
Move this file to `tests/ui/fail.stderr` to accept it as correct.
┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
error: expected pattern, found `;`
 --> tests/ui/fail.rs:2:8
  |
2 |     let;
  |        ^ expected pattern
┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈

test tests/ui/ok.rs [should fail to compile] ... error
Expected test case to fail to compile, but it succeeded.

test tests/ui/ok.rs [should pass] ... ok

test ui ... FAILED

Instead the last glob that applies to a particular file should be the only one that takes effect.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @dtolnay

      Issue actions

        Allow later globs to override pass/fail status of earlier globs · Issue #174 · dtolnay/trybuild