Skip to content

Commit

Permalink
Merge pull request #136 from compnerd/singularity
Browse files Browse the repository at this point in the history
Tests: avoid unnecessary duplication (NFCI)
  • Loading branch information
compnerd authored Jul 13, 2023
2 parents 022a7fe + e1ab868 commit 164fe8c
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions Tests/SystemTests/FilePathTests/FilePathTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,7 @@ import System
#endif

@available(/*System 0.0.1: macOS 11.0, iOS 14.0, watchOS 7.0, tvOS 14.0*/iOS 8, *)
func filePathFromInvalidCodePointSequence<S: Sequence>(_ bytes: S) -> FilePath where S.Element == UTF16.CodeUnit {
var array = Array(bytes)
assert(array.last != 0, "already null terminated")
array += [0]

return array.withUnsafeBufferPointer {
$0.withMemoryRebound(to: CInterop.PlatformChar.self) {
FilePath(platformString: $0.baseAddress!)
}
}
}

@available(/*System 0.0.1: macOS 11.0, iOS 14.0, watchOS 7.0, tvOS 14.0*/iOS 8, *)
func filePathFromInvalidCodePointSequence<S: Sequence>(_ bytes: S) -> FilePath where S.Element == UTF8.CodeUnit {
func filePathFromInvalidCodePointSequence<S: Sequence>(_ bytes: S) -> FilePath where S.Element == CInterop.PlatformUnicodeEncoding.CodeUnit {
var array = Array(bytes)
assert(array.last != 0, "already null terminated")
array += [0]
Expand Down

0 comments on commit 164fe8c

Please sign in to comment.