Skip to content

Commit a538e4f

Browse files
committed
[stdlib] Enable Mirror tests on non-Darwin platforms
1 parent ec0f68c commit a538e4f

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

test/1_stdlib/Mirror.swift

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,16 @@
1212
// RUN: rm -rf %t
1313
// RUN: mkdir -p %t
1414
//
15-
// RUN: %target-clang %S/Inputs/Mirror/Mirror.mm -c -o %t/Mirror.mm.o -g
16-
// RUN: %target-build-swift %s -I %S/Inputs/Mirror/ -Xlinker %t/Mirror.mm.o -o %t/Mirror
15+
// RUN: if [ %target-runtime == "objc" ]; \
16+
// RUN: then \
17+
// RUN: %target-clang %S/Inputs/Mirror/Mirror.mm -c -o %t/Mirror.mm.o -g && \
18+
// RUN: %target-build-swift %s -I %S/Inputs/Mirror/ -Xlinker %t/Mirror.mm.o -o %t/Mirror; \
19+
// RUN: else \
20+
// RUN: %target-build-swift %s -o %t/Mirror; \
21+
// RUN: fi
1722
// RUN: %target-run %t/Mirror
1823
// REQUIRES: executable_test
1924

20-
// XFAIL: linux
21-
2225
import StdlibUnittest
2326

2427

@@ -354,6 +357,7 @@ mirrors.test("class/CustomizedSuper/Synthesized") {
354357
}
355358
}
356359

360+
#if _runtime(_ObjC)
357361
import Foundation
358362

359363
//===--- ObjC Base Classes ------------------------------------------------===//
@@ -461,6 +465,7 @@ mirrors.test("class/ObjCCustomizedSuper/Synthesized") {
461465
}
462466
}
463467
}
468+
#endif // _runtime(_ObjC)
464469

465470
//===--- Suppressed Superclass Mirrors ------------------------------------===//
466471
mirrors.test("Class/Root/NoSuperclassMirror") {
@@ -717,7 +722,10 @@ mirrors.test("PlaygroundQuickLook") {
717722
struct X {}
718723
switch PlaygroundQuickLook(reflecting: X()) {
719724
case .text(let text):
725+
#if _runtime(_ObjC)
726+
// FIXME: Enable if non-objc hasSuffix is implemented.
720727
expectTrue(text.hasSuffix(".(X #1)()"), text)
728+
#endif
721729
default:
722730
expectTrue(false)
723731
}
@@ -759,13 +767,15 @@ mirrors.test("_DefaultCustomPlaygroundQuickLookable") {
759767
}
760768
}
761769

770+
#if _runtime(_ObjC)
762771
import MirrorObjC
763772
mirrors.test("ObjC") {
764773
// Some Foundation classes lie about their ivars, which would crash
765774
// a mirror; make sure we are not automatically exposing ivars of
766775
// Objective-C classes from the default mirror implementation.
767776
expectEqual(0, Mirror(reflecting: HasIVars()).children.count)
768777
}
778+
#endif
769779

770780
mirrors.test("String.init") {
771781
expectEqual("42", String(42))

0 commit comments

Comments
 (0)