mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[test] Make string internal testing a little more robust; NFC
Add an isSmall query to Character so testing doesn't have to bake in internal format. Clarify the purpose of the invalid UTF-16 backdoor creation method.
This commit is contained in:
@@ -1255,19 +1255,6 @@ extension _StringGuts {
|
||||
}
|
||||
}
|
||||
|
||||
extension _StringGuts {
|
||||
// For testing purposes only. Might be both inefficient and too low-level.
|
||||
// There should be an eventual API on String to accomplish something similar.
|
||||
@usableFromInline // @_testable
|
||||
static internal
|
||||
func _createStringFromUTF16(_ cus: UnsafeBufferPointer<UInt16>) -> String {
|
||||
let storage = _SwiftStringStorage<UTF16.CodeUnit>.create(
|
||||
capacity: cus.count, count: cus.count)
|
||||
_ = storage._initialize(fromCodeUnits: cus, encoding: UTF16.self)
|
||||
return String(_StringGuts(_large: storage))
|
||||
}
|
||||
}
|
||||
|
||||
extension _SwiftStringStorage {
|
||||
/// Initialize a piece of freshly allocated storage instance from a sequence
|
||||
/// of code units, which is assumed to contain exactly as many code units as
|
||||
|
||||
Reference in New Issue
Block a user