Skip to content

Duplicated tests when combined with test_log #146

@bjackman

Description

@bjackman

It's unclear to me if this is really a bug or just the expected outcome of Rust's weird test case registration system.

❯❯ cat Cargo.toml
[package]
name = "t"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
test-case = "3.3.1"
test-log = "0.2.16"

[[bin]]
name = "t"
path = "main.rs"

❯❯ cat main.rs
fn main() {
    println!("Hello, world!");
}

mod tests {
    use test_case::test_case;
    use test_log;
    
    #[test_case(1; "pollo mundo")]
    #[test_log::test]
    fn test_once(_arg: u8) {
        assert!(true);
    }
}

❯❯ cargo test
    Finished test [unoptimized + debuginfo] target(s) in 0.02s
     Running unittests main.rs (target/debug/deps/t-fe670cbfe3e221f9)

running 2 tests
test tests::test_once::pollo_mundo ... ok
test tests::test_once::pollo_mundo ... ok

test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

Any idea if there's a workaround for that? In this case it's quite easy to drop test_log but I guess there might be many similar cases where the test wrapper macro is more valuable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions