File tree 1 file changed +18
-0
lines changed
Tests/SwiftAlgorithmsTests
1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -176,5 +176,23 @@ final class ReplaceSubrangeTests: XCTestCase {
176
176
XCTAssertEqualCollections ( result, " hello, wo " )
177
177
IndexValidator ( ) . validate ( result, expectedCount: 9 )
178
178
}
179
+
180
+ // Location: entire collection
181
+ // Replacement: non-empty
182
+ do {
183
+ let base = " hello, world! "
184
+ let result = base. lazy. replacingSubrange ( base. startIndex..< base. endIndex, with: Array ( " blah blah blah " ) )
185
+ XCTAssertEqualCollections ( result, " blah blah blah " )
186
+ IndexValidator ( ) . validate ( result, expectedCount: 14 )
187
+ }
188
+
189
+ // Location: entire collection
190
+ // Replacement: empty
191
+ do {
192
+ let base = " hello, world! "
193
+ let result = base. lazy. replacingSubrange ( base. startIndex..< base. endIndex, with: EmptyCollection ( ) )
194
+ XCTAssertEqualCollections ( result, " " )
195
+ IndexValidator ( ) . validate ( result, expectedCount: 0 )
196
+ }
179
197
}
180
198
}
You can’t perform that action at this time.
0 commit comments