Skip to content

Commit 4bc3ead

Browse files
committed
[test] UTF8Span from inline-stored Substring instances
1 parent 664cc69 commit 4bc3ead

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

@@ -112,3 +112,18 @@ suite.test("UTF8Span from Span")
112112
let span2 = utf8.span
113113
expectTrue(span1.isIdentical(to: span2))
114114
}
115+
116+
suite.test("Span from Substring.utf8Span")
117+
.require(.stdlib_6_2).code {
118+
guard #available(SwiftStdlib 6.2, *) else { return }
119+
120+
let s = String(22000).dropFirst().dropLast()
121+
let utf8span = s.utf8Span
122+
let span1 = utf8span.span
123+
let utf8view = s.utf8
124+
let span2 = utf8view.span
125+
expectEqual(span1.count, span2.count)
126+
for (i,j) in zip(span1.indices, span2.indices) {
127+
expectEqual(span1[i], span2[j])
128+
}
129+
}

0 commit comments

Comments
 (0)