File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change 11// RUN: %target-run-simple-swift(-I %S/Inputs -Xfrontend -enable-experimental-cxx-interop -Xcc -std=c++20)
2+ // RUN: %target-run-simple-swift(-I %S/Inputs -Xfrontend -enable-experimental-cxx-interop -Xcc -std=c++20 -Xcc -D_LIBCPP_ENABLE_HARDENED_MODE)
23
34// FIXME swift-ci linux tests do not support std::span
45// UNSUPPORTED: OS=linux-gnu
@@ -13,6 +14,24 @@ import CxxStdlib
1314
1415var StdSpanTestSuite = TestSuite ( " StdSpan " )
1516
17+ func takesSpanOfInt( _ s: Span ) {
18+ expectEqual ( s. size ( ) , 3 )
19+ expectFalse ( s. empty ( ) )
20+
21+ expectEqual ( s [ 0 ] , 1 )
22+ expectEqual ( s [ 1 ] , 2 )
23+ expectEqual ( s [ 2 ] , 3 )
24+ }
25+
26+ func takesSpanOfString( _ s: SpanOfString ) {
27+ expectEqual ( s. size ( ) , 3 )
28+ expectFalse ( s. empty ( ) )
29+
30+ expectEqual ( s [ 0 ] , " " )
31+ expectEqual ( s [ 1 ] , " ab " )
32+ expectEqual ( s [ 2 ] , " abc " )
33+ }
34+
1635StdSpanTestSuite . test ( " EmptySpan " ) {
1736 let s = Span ( )
1837 expectEqual ( s. size ( ) , 0 )
@@ -43,4 +62,12 @@ StdSpanTestSuite.test("InitStringSpan") {
4362 expectEqual ( sspan [ 2 ] , " abc " )
4463}
4564
65+ StdSpanTestSuite . test ( " SpanOfIntAsParam " ) {
66+ takesSpanOfInt ( ispan)
67+ }
68+
69+ StdSpanTestSuite . test ( " SpanOfStringAsParam " ) {
70+ takesSpanOfString ( sspan)
71+ }
72+
4673runAllTests ( )
You can’t perform that action at this time.
0 commit comments