Skip to content

skip this test until string guts are in our submission branch #1445

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Feb 23, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 43 additions & 19 deletions TestFoundation/TestNSString.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1211,41 +1211,61 @@ class TestNSString : XCTestCase {
}

struct ComparisonTest {
enum TestBehavior {
case run
case expectedFailure(String)
case skip(String)
}
let lhs: String
let rhs: String
let loc: UInt
let reason: String
let behavior: TestBehavior

var xfail: Bool {
return !reason.isEmpty
var expectedFailure: Bool {
if case .expectedFailure = behavior {
return true
} else {
return false
}
}

init(
_ lhs: String, _ rhs: String,
reason: String = "", line: UInt = #line
) {
self.lhs = lhs
self.rhs = rhs
self.reason = reason
self.loc = line
_ lhs: String, _ rhs: String,
expectedFailure xfailReason: String = "",
skip skipReason: String = "",
line: UInt = #line
) {
self.lhs = lhs
self.rhs = rhs
self.loc = line

switch (xfailReason.isEmpty, skipReason.isEmpty) {
case (false, true):
behavior = .expectedFailure(xfailReason)
case (_, false):
behavior = .skip(skipReason)
default:
behavior = .run
}
}
}

let comparisonTests = [
let comparisonTests: [ComparisonTest] = [
ComparisonTest("", ""),
ComparisonTest("", "a"),

// ASCII cases
ComparisonTest("t", "tt"),
ComparisonTest("t", "Tt"),
ComparisonTest("\u{0}", ""),
ComparisonTest("\u{0}", "",
skip: "rdar://problem/37686816"),
ComparisonTest("\u{0}", "\u{0}",
reason: "https://bugs.swift.org/browse/SR-332"),
expectedFailure: "https://bugs.swift.org/browse/SR-332"),
ComparisonTest("\r\n", "t"),
ComparisonTest("\r\n", "\n",
reason: "blocked on rdar://problem/19036555"),
expectedFailure: "blocked on rdar://problem/19036555"),
ComparisonTest("\u{0}", "\u{0}\u{0}",
reason: "rdar://problem/19034601"),
expectedFailure: "rdar://problem/19034601"),

// Whitespace
// U+000A LINE FEED (LF)
Expand Down Expand Up @@ -1309,7 +1329,7 @@ let comparisonTests = [
// U+1F1E7 REGIONAL INDICATOR SYMBOL LETTER B
// \u{1F1E7}\u{1F1E7} Flag of Barbados
ComparisonTest("\u{1F1E7}", "\u{1F1E7}\u{1F1E7}",
reason: "https://bugs.swift.org/browse/SR-367"),
expectedFailure: "https://bugs.swift.org/browse/SR-367"),

// Test that Unicode collation is performed in deterministic mode.
//
Expand All @@ -1325,7 +1345,7 @@ let comparisonTests = [
// U+0301 and U+0954 don't decompose in the canonical decomposition mapping.
// U+0341 has a canonical decomposition mapping of U+0301.
ComparisonTest("\u{0301}", "\u{0341}",
reason: "https://bugs.swift.org/browse/SR-243"),
expectedFailure: "https://bugs.swift.org/browse/SR-243"),
ComparisonTest("\u{0301}", "\u{0954}"),
ComparisonTest("\u{0341}", "\u{0954}"),
]
Expand Down Expand Up @@ -1385,6 +1405,10 @@ func checkHasPrefixHasSuffix(_ lhs: String, _ rhs: String, _ stack: [UInt]) -> I
extension TestNSString {
func test_PrefixSuffix() {
for test in comparisonTests {
if case .skip = test.behavior {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the PR is claiming a skip of a single test but that seems rather contrary to the additions and refactoring of reasons to xfail etc. Can we split this up into two parts?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Normally, I'd be fine with that but we're trying to unblock testing and I don't think it's worth while to have 2 PRs for such a small change. I can split it up if you insist but I'd rather just unblock CI.

continue
}

var failures = 0
failures += checkHasPrefixHasSuffix(test.lhs, test.rhs, [test.loc, #line])
failures += checkHasPrefixHasSuffix(test.rhs, test.lhs, [test.loc, #line])
Expand All @@ -1400,9 +1424,9 @@ extension TestNSString {
let fail = (failures > 0)
if fail {
// print("Prefix/Suffix case \(test.loc): \(failures) failures")
// print("Failures were\(test.xfail ? "" : " not") expected")
// print("Failures were\(test.expectedFailure ? "" : " not") expected")
}
XCTAssert(test.xfail == fail, "Unexpected \(test.xfail ?"success":"failure"): \(test.loc)")
XCTAssert(test.expectedFailure == fail, "Unexpected \(test.expectedFailure ?"success":"failure"): \(test.loc)")
}
}
}
Expand Down