Skip to content

Commit f051d6b

Browse files
author
Lance Parker
committed
added an opaque flavor of the normalization tests
1 parent 5c2d6ac commit f051d6b

File tree

1 file changed

+27
-3
lines changed

1 file changed

+27
-3
lines changed

validation-test/stdlib/StringNormalization.swift

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,28 @@
99
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
1010
//
1111
//===----------------------------------------------------------------------===//
12-
// RUN: mkdir -p %t
13-
// RUN: %target-build-swift %s -o %t/a.out
12+
// RUN: %empty-directory(%t)
13+
// RUN: if [ %target-runtime == "objc" ]; \
14+
// RUN: then \
15+
// RUN: %target-clang -fobjc-arc %S/Inputs/NSSlowString/NSSlowString.m -c -o %t/NSSlowString.o && \
16+
// RUN: %target-build-swift -I %S/Inputs/NSSlowString/ %t/NSSlowString.o %s -o %t/a.out; \
17+
// REQUIRES: objc_interop
18+
// RUN: else \
19+
// RUN: %target-build-swift %s -o %t/a.out; \
20+
// RUN: fi
21+
22+
// RUN: %target-codesign %t/a.out
1423
// RUN: %target-run %t/a.out %S/Inputs/NormalizationTest.txt
1524
// REQUIRES: executable_test
16-
// REQUIRES: objc_interop
1725

1826
import Swift
1927
import StdlibUnittest
2028
import StdlibUnicodeUnittest
2129

30+
#if _runtime(_ObjC)
31+
import NSSlowString
32+
#endif
33+
2234
private func expectEqualIterators(
2335
label: String,
2436
expected: [UInt8],
@@ -453,6 +465,18 @@ for (i, test) in codeUnitNormalizationTests.enumerated() {
453465
let codeUnits = test.1._nfcCodeUnits
454466
expectEqual(test.0, codeUnits)
455467
}
468+
#if _runtime(_ObjC)
469+
tests.test("CodeUnitNormalizationTest#\(i)/Opaque")
470+
.skip(.custom({
471+
if #available(macOS 10.14, iOS 12, watchOS 5, tvOS 12, *) { return false }
472+
return true
473+
}, reason: "NormalizationTest.txt requires Unicode 11"))
474+
.code {
475+
let opaqueString = NSSlowString(string: test.1) as String
476+
let codeUnits = opaqueString._nfcCodeUnits
477+
expectEqual(test.0, codeUnits)
478+
}
479+
#endif
456480
}
457481

458482
runAllTests()

0 commit comments

Comments
 (0)