Skip to content

Commit 98e6731

Browse files
committed
Test fixes for Darwin
- lastPathComponent is a NSString method so bridge appropiately. - JSONEncoder.OutputFormatting.sortedKeys requires macOS 10.13, add an #available around it.
1 parent 4a8a22c commit 98e6731

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

Tests/Foundation/Tests/TestFileManager.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1785,10 +1785,10 @@ VIDEOS=StopgapVideos
17851785

17861786
// Relative Paths
17871787
".\\testfile",
1788-
"..\\\(tmpPath.lastPathComponent)\\.\\testfile",
1788+
"..\\\((tmpPath as NSString).lastPathComponent)\\.\\testfile",
17891789
"testfile",
17901790
"./testfile",
1791-
"../\(tmpPath.lastPathComponent)/./testfile",
1791+
"../\((tmpPath as NSString).lastPathComponent)/./testfile",
17921792

17931793
// UNC Paths
17941794
"\\\\.\\\(tmpPath)\\testfile",

Tests/Foundation/Tests/TestJSONEncoder.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -855,7 +855,9 @@ class TestJSONEncoder : XCTestCase {
855855

856856
func test_OutputFormattingValues() {
857857
XCTAssertEqual(JSONEncoder.OutputFormatting.prettyPrinted.rawValue, 1)
858-
XCTAssertEqual(JSONEncoder.OutputFormatting.sortedKeys.rawValue, 2)
858+
if #available(OSX 10.13, *) {
859+
XCTAssertEqual(JSONEncoder.OutputFormatting.sortedKeys.rawValue, 2)
860+
}
859861
XCTAssertEqual(JSONEncoder.OutputFormatting.withoutEscapingSlashes.rawValue, 8)
860862
}
861863

0 commit comments

Comments
 (0)