You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you write a parameterised @Test, and in the arguments param pass the same list value twice, we get a fatal crash.
This problem occurs for parameter lists where the entries are computed, as well as for tests param lists giving literal values (see repro below).
If non-repeating values is an expected input condition I'd expect the Testing API documentation to call this out explicitly. The semantics of passing a Collection of Sendable (and not e.g. a set or map) imply equal params shouldn't cause an issue?
Clarity might be needed around to what extent any code being tested can go in parameter lists, or not? And what constitutes "testing code" (e.g. the example below. In effect it's testing ! (not) operator. Would ! itself be considered 'testing code'?)
Reproduction
@Test("bool negation operator", arguments:[(true,true), // control case (no negation used)(!true,false), // negate once(!(!true),true), // negate twice])func testBoolNegation(lhs:Bool, rhs:Bool){
#expect(lhs == rhs)}@Test("bool negation operator (using literals)", arguments:[(true,true), // control case (no negation used)(false,false), // negate once(true,true), // negate twice])func testBoolNegationWithLiterals(lhs:Bool, rhs:Bool){
#expect(lhs == rhs)}
Running this simple example with Testing causes a fatal crash:
libswiftCore.dylib`_swift_runtime_on_report: Thread 5: Fatal error: Internal inconsistency: No test reporter for test case argumentiDs: Optional ([Testing.Test.Case.Argument.ID(bytes: [102, 97, 108, 115, 101]), Testing.Test.Case.Argument.ID(bytes: [102, 97, 108, 115, 101])]) in test ScratchTests/testBoolNegation(Ihs:rhs:)/ScratchTests.swift:15:6
If you comment out the first or third line of the test params, the duplicated value is removed and the test passes.
Expected behavior
The given @Test sample code should pass.
OR documentation should detail this limitation, and cause a more informative test failure message (not a crash): e.g malformed test arguments -- do not use the same value twice.
Environment
swift-driver version: 1.115 Apple Swift version 6.0.2 (swiftlang-6.0.2.1.2 clang-1600.0.26.4)
Darwin MacBook-Pro-2021.local 24.3.0 Darwin Kernel Version 24.3.0: Thu Jan 2 20:24:16 PST 2025; root:xnu-11215.81.4~3/RELEASE_ARM64_T6000 arm64
The text was updated successfully, but these errors were encountered:
There are two issues: one is in Swift Testing, and was recently fixed in #1000; the other is in Xcode, and is tracked by rdar://121455205. Since I can only dupe to GitHub issues I'll dupe this to the former.
Uh oh!
There was an error while loading. Please reload this page.
Description
If you write a parameterised
@Test
, and in thearguments
param pass the same list value twice, we get a fatal crash.This problem occurs for parameter lists where the entries are computed, as well as for tests param lists giving literal values (see repro below).
If non-repeating values is an expected input condition I'd expect the Testing API documentation to call this out explicitly. The semantics of passing a
Collection
of Sendable (and not e.g. a set or map) imply equal params shouldn't cause an issue?(I'm aware of the discussion at https://github.com/swiftlang/swift-evolution/blob/main/visions/swift-testing.md#test-identity on related matters, but still not sure what this implies about this issue report)
Clarity might be needed around to what extent any code being tested can go in parameter lists, or not? And what constitutes "testing code" (e.g. the example below. In effect it's testing
!
(not) operator. Would!
itself be considered 'testing code'?)Reproduction
Running this simple example with Testing causes a fatal crash:
If you comment out the first or third line of the test params, the duplicated value is removed and the test passes.
Expected behavior
The given
@Test
sample code should pass.OR documentation should detail this limitation, and cause a more informative test failure message (not a crash): e.g
malformed test arguments -- do not use the same value twice
.Environment
swift-driver version: 1.115 Apple Swift version 6.0.2 (swiftlang-6.0.2.1.2 clang-1600.0.26.4)
Darwin MacBook-Pro-2021.local 24.3.0 Darwin Kernel Version 24.3.0: Thu Jan 2 20:24:16 PST 2025; root:xnu-11215.81.4~3/RELEASE_ARM64_T6000 arm64
The text was updated successfully, but these errors were encountered: