Skip to content

Commit 03208a6

Browse files
committed
[test] spans over bridged Substring instances
1 parent 9ae58c9 commit 03208a6

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

test/stdlib/Span/StringUTF8SpanProperty.swift

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,3 +107,19 @@ strings.forEach { string, expected in
107107
}
108108
}
109109
}
110+
111+
strings.forEach { string, expected in
112+
suite.test("Span from Bridged String Substring: \(expected)")
113+
.require(.stdlib_6_2).code {
114+
guard #available(SwiftStdlib 6.2, *) else { return }
115+
116+
let bridged = String(string).dropFirst()
117+
let utf8 = bridged.utf8
118+
let span = utf8.span
119+
let expected = expected.dropFirst()
120+
expectEqual(span.count, expected.utf8.count)
121+
for (i,j) in zip(span.indices, expected.utf8.indices) {
122+
expectEqual(span[i], expected.utf8[j])
123+
}
124+
}
125+
}

0 commit comments

Comments
 (0)