Skip to content

Commit 8a2ff96

Browse files
committed
[test] UTF8Span from inline-stored Substring instances
1 parent 83edacb commit 8a2ff96

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

test/stdlib/Span/StringUTF8SpanProperty.swift

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ suite.test("Span from Large Native String's Substring")
8686
}
8787
}
8888

89-
suite.test("Span from UTF8Span")
89+
suite.test("Span from String.utf8Span")
9090
.require(.stdlib_6_2).code {
9191
guard #available(SwiftStdlib 6.2, *) else { return }
9292

@@ -117,3 +117,18 @@ suite.test("UTF8Span from Span")
117117
expectEqual(span1[i], span2[j])
118118
}
119119
}
120+
121+
suite.test("Span from Substring.utf8Span")
122+
.require(.stdlib_6_2).code {
123+
guard #available(SwiftStdlib 6.2, *) else { return }
124+
125+
let s = String(22000).dropFirst().dropLast()
126+
let utf8span = s.utf8Span
127+
let span1 = utf8span.span
128+
let utf8view = s.utf8
129+
let span2 = utf8view.span
130+
expectEqual(span1.count, span2.count)
131+
for (i,j) in zip(span1.indices, span2.indices) {
132+
expectEqual(span1[i], span2[j])
133+
}
134+
}

0 commit comments

Comments
 (0)