-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
bugObserved behavior contradicts documented or intended behaviorObserved behavior contradicts documented or intended behavior
Milestone
Description
Zig Version
0.11.0-dev.1571+c1f71963a
Steps to Reproduce and Observed Behavior
If you have two tests with the same name, the first test is silently ignored:
/home/geemili/src/1_projects/zig-duplicate-tests-ignored〉cat test.zig
const std = @import("std");
test "hello, world" {
try std.testing.expect(false);
}
test "hello, world" {}
/home/geemili/src/1_projects/zig-duplicate-tests-ignored〉zig test test.zig
All 1 tests passed.
/home/geemili/src/1_projects/zig-duplicate-tests-ignored〉cat test2.zig
const std = @import("std");
test "hello, world" {}
test "hello, world" {
try std.testing.expect(false);
}
/home/geemili/src/1_projects/zig-duplicate-tests-ignored〉zig test test2.zig
Test [1/1] test.hello, world... FAIL (TestUnexpectedResult)
/nix/store/98lrh5sqnafkfm0bc8j3i4s195pslnkn-zig-0.11.0-dev.1571+c1f71963a/lib/std/testing.zig:509:14: 0x20bed7 in expect (test)
if (!ok) return error.TestUnexpectedResult;
^
/home/geemili/src/1_projects/zig-duplicate-tests-ignored/test2.zig:5:5: 0x20bff5 in test.hello, world (test)
try std.testing.expect(false);
^
0 passed; 0 skipped; 1 failed.
error: the following test command failed with exit code 1:
/home/geemili/.cache/zig/o/318d87d03fcd418787f6d0541913fd40/test
Specific times when I've run into this problem:
I copied a test case and forgot to update the name. Was then confused when it did not produce an error. The confusion was resolved when I relized I needed to change the name of one of the tests.
Expected Behavior
- An error should be thrown, complaining about duplicate test names
- OR both tests should be run
Metadata
Metadata
Assignees
Labels
bugObserved behavior contradicts documented or intended behaviorObserved behavior contradicts documented or intended behavior