Skip to content

Commit fed521d

Browse files
committed
Set NS_FOUNDATION_ALLOWS_TESTABLE_IMPORT when ENABLE_TESTING is set.
- Disable TestThread.test_threadName() as some of the tests are currently broken. - Disable testing of FileManager._replaceItem() on Windows as it is not currently implemented on that platform.
1 parent 326c78f commit fed521d

File tree

4 files changed

+8
-3
lines changed

4 files changed

+8
-3
lines changed

TestFoundation/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,11 @@ target_link_libraries(TestFoundation PRIVATE
115115
FoundationXML)
116116
target_link_libraries(TestFoundation PRIVATE
117117
XCTest)
118+
if(ENABLE_TESTING)
119+
target_compile_definitions(TestFoundation PRIVATE
120+
NS_FOUNDATION_ALLOWS_TESTABLE_IMPORT)
121+
endif()
122+
118123

119124
# NOTE(compnerd) create a test "app" directory as we need the xdgTestHelper as
120125
# an executable peer and the binary will be placed in the directory with the

TestFoundation/TestFileManager.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1755,7 +1755,7 @@ VIDEOS=StopgapVideos
17551755
}
17561756
#endif
17571757

1758-
#if NS_FOUNDATION_ALLOWS_TESTABLE_IMPORT
1758+
#if NS_FOUNDATION_ALLOWS_TESTABLE_IMPORT && !os(Windows) // Not implemented on Windows yet
17591759
print("note: Testing cross-platform replace implementation.", to: &stderr)
17601760
try testReplaceMethod { (a, b, backupItemName, options) -> URL? in
17611761
try fm._replaceItem(at: a, withItemAt: b, backupItemName: backupItemName, options: options, allowPlatformSpecificSyscalls: false)

TestFoundation/TestObjCRuntime.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class TestObjCRuntime: XCTestCase {
6464
#if NS_FOUNDATION_ALLOWS_TESTABLE_IMPORT
6565
func testClassesRenamedByAPINotes() throws {
6666
for entry in _NSClassesRenamedByObjCAPINotes {
67-
XCTAssert(NSClassFromString(NSStringFromClass(entry.class)) === entry.class)
67+
XCTAssert(try XCTUnwrap(NSClassFromString(NSStringFromClass(entry.class))) === entry.class)
6868
XCTAssert(NSStringFromClass(try XCTUnwrap(NSClassFromString(entry.objCName))) == entry.objCName)
6969
}
7070
}

TestFoundation/TestThread.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class TestThread : XCTestCase {
3131
("test_sleepUntilDate", test_sleepUntilDate),
3232
]
3333

34-
#if NS_FOUNDATION_ALLOWS_TESTABLE_IMPORT
34+
#if NS_FOUNDATION_ALLOWS_TESTABLE_IMPORT && false // Disable for now as some tests are broken
3535
tests.append(contentsOf: [
3636
("test_threadName", test_threadName),
3737
])

0 commit comments

Comments
 (0)