Fix unit tests that relied on nontrivial to raw conversion.

This commit is contained in:
Andrew Trick
2023-02-21 17:46:45 -08:00
parent 64e1ce26a8
commit a354f26d55
2 changed files with 13 additions and 9 deletions

View File

@@ -84,14 +84,17 @@ func nsEncode<CodeUnit>(
length: 4,
encoding: String.Encoding.utf32LittleEndian.rawValue)!
s.getBytes(
&buffer,
maxLength: buffer.count,
usedLength: &used,
encoding: encoding.rawValue,
options: [],
range: NSRange(location: 0, length: s.length),
remaining: nil)
let count = buffer.count
_ = buffer.withUnsafeMutableBytes { bufferBytes in
s.getBytes(
bufferBytes.baseAddress,
maxLength: count,
usedLength: &used,
encoding: encoding.rawValue,
options: [],
range: NSRange(location: 0, length: s.length),
remaining: nil)
}
}
final class CodecTest<Codec : TestableUnicodeCodec> {