added an opaque flavor of the normalization tests

This commit is contained in:
Lance Parker
2018-12-04 17:27:03 -08:00
parent 5c2d6acc64
commit f051d6b9e4

View File

@@ -9,16 +9,28 @@
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// RUN: mkdir -p %t // RUN: %empty-directory(%t)
// RUN: %target-build-swift %s -o %t/a.out // RUN: if [ %target-runtime == "objc" ]; \
// RUN: then \
// RUN: %target-clang -fobjc-arc %S/Inputs/NSSlowString/NSSlowString.m -c -o %t/NSSlowString.o && \
// RUN: %target-build-swift -I %S/Inputs/NSSlowString/ %t/NSSlowString.o %s -o %t/a.out; \
// REQUIRES: objc_interop
// RUN: else \
// RUN: %target-build-swift %s -o %t/a.out; \
// RUN: fi
// RUN: %target-codesign %t/a.out
// RUN: %target-run %t/a.out %S/Inputs/NormalizationTest.txt // RUN: %target-run %t/a.out %S/Inputs/NormalizationTest.txt
// REQUIRES: executable_test // REQUIRES: executable_test
// REQUIRES: objc_interop
import Swift import Swift
import StdlibUnittest import StdlibUnittest
import StdlibUnicodeUnittest import StdlibUnicodeUnittest
#if _runtime(_ObjC)
import NSSlowString
#endif
private func expectEqualIterators( private func expectEqualIterators(
label: String, label: String,
expected: [UInt8], expected: [UInt8],
@@ -453,6 +465,18 @@ for (i, test) in codeUnitNormalizationTests.enumerated() {
let codeUnits = test.1._nfcCodeUnits let codeUnits = test.1._nfcCodeUnits
expectEqual(test.0, codeUnits) expectEqual(test.0, codeUnits)
} }
#if _runtime(_ObjC)
tests.test("CodeUnitNormalizationTest#\(i)/Opaque")
.skip(.custom({
if #available(macOS 10.14, iOS 12, watchOS 5, tvOS 12, *) { return false }
return true
}, reason: "NormalizationTest.txt requires Unicode 11"))
.code {
let opaqueString = NSSlowString(string: test.1) as String
let codeUnits = opaqueString._nfcCodeUnits
expectEqual(test.0, codeUnits)
}
#endif
} }
runAllTests() runAllTests()