 import StdlibUnittestFoundationExtras
 #endif
 
-var NSStringAPIs = TestSuite("NSStringAPIs")
+var StringTests = TestSuite("StringTests")
+
+var objCPresent: Bool {
+#if _runtime(_ObjC)
+  return true
+#else
+  return false
+#endif
+}
 
 struct ComparisonTest {
   let expectedUnicodeCollation: ExpectedComparisonResult
   let lhs: String
   let rhs: String
   let loc: SourceLoc
+  let xfail: TestRunPredicate
 
   init(
     _ expectedUnicodeCollation: ExpectedComparisonResult,
     _ lhs: String, _ rhs: String,
+    xfail: TestRunPredicate = .Custom({false}, reason: ""),
     file: String = __FILE__, line: UInt = __LINE__
   ) {
     self.expectedUnicodeCollation = expectedUnicodeCollation
     self.lhs = lhs
     self.rhs = rhs
     self.loc = SourceLoc(file, line, comment: "test data")
+    self.xfail = xfail
   }
 }
 

func checkHasPrefixHasSuffix(
  lhs: String, _ rhs: String, _ stackTrace: SourceLocStack
) {
  if lhs == "" {
    return
  }


  // ASCII cases
  ComparisonTest(.LT, "t", "tt"),
  ComparisonTest(.GT, "t", "Tt",
    xfail: .Custom({ objCPresent == false },
      reason: "Compares in reverse with ICU, https://bugs.swift.org/browse/SR-530")),
  ComparisonTest(.GT, "\u{0}", "",
    xfail: .Custom({ objCPresent == false },
      reason: "Null-related issue: https://bugs.swift.org/browse/SR-630")),
  ComparisonTest(.EQ, "\u{0}", "\u{0}"),
  // Currently fails:
  // ComparisonTest(.LT, "\r\n", "t"),
