Skip to content

Commit 81c29c7

Browse files
author
Lance Parker
committed
Fix ambiguous init failure
1 parent e16e682 commit 81c29c7

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

TestFoundation/TestNSString.swift

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1230,23 +1230,23 @@ struct ComparisonTest {
12301230
}
12311231

12321232
init(
1233-
_ lhs: String, _ rhs: String,
1234-
expectedFailure reason: String = "", line: UInt = #line
1235-
) {
1236-
self.lhs = lhs
1237-
self.rhs = rhs
1238-
self.behavior = reason.isEmpty ? .run : .expectedFailure(reason)
1239-
self.loc = line
1240-
}
1233+
_ lhs: String, _ rhs: String,
1234+
expectedFailure xfailReason: String = "",
1235+
skip skipReason: String = "",
1236+
line: UInt = #line
1237+
) {
1238+
self.lhs = lhs
1239+
self.rhs = rhs
1240+
self.loc = line
12411241

1242-
init(
1243-
_ lhs: String, _ rhs: String,
1244-
skip reason: String = "", line: UInt = #line
1245-
) {
1246-
self.lhs = lhs
1247-
self.rhs = rhs
1248-
self.behavior = reason.isEmpty ? .run : .skip(reason)
1249-
self.loc = line
1242+
switch (xfailReason.isEmpty, skipReason.isEmpty) {
1243+
case (false, true):
1244+
behavior = .expectedFailure(xfailReason)
1245+
case (_, false):
1246+
behavior = .skip(skipReason)
1247+
default:
1248+
behavior = .run
1249+
}
12501250
}
12511251
}
12521252

0 commit comments

Comments
 (0)