[stdlib] Make String.UTF8View bidirectional

This is a step along the way toward handling backward-compatiblity of UTF8View
slicing and preventing inadvertent creation of String instances that keep
inaccessible memory alive.
This commit is contained in:
Dave Abrahams
2017-07-17 11:26:35 -07:00
parent 56705736b4
commit e6519fbd2b
7 changed files with 116 additions and 38 deletions

View File

@@ -59,10 +59,10 @@ StringTests.test("AssociatedTypes-UTF8View") {
expectCollectionAssociatedTypes(
collectionType: View.self,
iteratorType: View.Iterator.self,
subSequenceType: Slice<View>.self,
subSequenceType: BidirectionalSlice<View>.self,
indexType: View.Index.self,
indexDistanceType: Int.self,
indicesType: DefaultIndices<View>.self)
indicesType: DefaultBidirectionalIndices<View>.self)
}
StringTests.test("AssociatedTypes-UTF16View") {

View File

@@ -728,8 +728,7 @@ tests.test("String.UTF8View/Collection")
.forEach(in: utfTests) {
test in
// FIXME(ABI)#72 : should be `checkBidirectionalCollection`.
checkForwardCollection(test.utf8, test.string.utf8) { $0 == $1 }
checkBidirectionalCollection(test.utf8, test.string.utf8) { $0 == $1 }
}
tests.test("String.UTF16View/BidirectionalCollection")