Skip to content

Commit 92aef64

Browse files
authored
FoundationEssentialsTests: repair the test suite on Windows (#657)
We would use the Unix (non-portable) arc separator (`/`). On Windows, we need to ensure that we account for the proper arc separator (`\`) when checking the FSR of the string.
1 parent 418fe5b commit 92aef64

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Tests/FoundationEssentialsTests/StringTests.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,8 +338,12 @@ final class StringTests : XCTestCase {
338338
func assertCString(_ ptr: UnsafePointer<CChar>, equals other: String, file: StaticString = #filePath, line: UInt = #line) {
339339
XCTAssertEqual(String(cString: ptr), other, file: file, line: line)
340340
}
341-
341+
342+
#if os(Windows)
343+
let original = #"\Path1\Path Two\Path Three\Some Really Long File Name Section.txt"#
344+
#else
342345
let original = "/Path1/Path Two/Path Three/Some Really Long File Name Section.txt"
346+
#endif
343347
original.withFileSystemRepresentation {
344348
XCTAssertNotNil($0)
345349
assertCString($0!, equals: original)

0 commit comments

Comments
 (0)