File tree Expand file tree Collapse file tree 3 files changed +44
-1
lines changed Expand file tree Collapse file tree 3 files changed +44
-1
lines changed Original file line number Diff line number Diff line change 1
1
module StdVector {
2
2
header "std-vector.h"
3
- }
3
+ requires cplusplus
4
+ }
5
+
6
+ module StdString {
7
+ header "std-string.h"
8
+ requires cplusplus
9
+ }
Original file line number Diff line number Diff line change
1
+ #ifndef TEST_INTEROP_CXX_STDLIB_INPUTS_STD_STRING_H
2
+ #define TEST_INTEROP_CXX_STDLIB_INPUTS_STD_STRING_H
3
+
4
+ #include < string>
5
+
6
+ using CxxString = std::string;
7
+
8
+ #endif // TEST_INTEROP_CXX_STDLIB_INPUTS_STD_STRING_H
Original file line number Diff line number Diff line change
1
+ // RUN: %target-run-simple-swift(-I %S/Inputs -Xfrontend -enable-cxx-interop)
2
+ //
3
+ // REQUIRES: executable_test
4
+ //
5
+ // Enable this everywhere once we have a solution for modularizing libstdc++: rdar://87654514
6
+ // REQUIRES: OS=macosx
7
+
8
+ import StdlibUnittest
9
+ import StdString
10
+ import std. string
11
+
12
+ var StdStringTestSuite = TestSuite ( " StdString " )
13
+
14
+ StdStringTestSuite . test ( " init " ) {
15
+ let s = CxxString ( )
16
+ expectEqual ( s. size ( ) , 0 )
17
+ expectTrue ( s. empty ( ) )
18
+ }
19
+
20
+ // LLVM module verification fails for calls to std::string::push_back: rdar://88343327
21
+ // StdStringTestSuite.test("push back") {
22
+ // var s = CxxString()
23
+ // s.push_back(42)
24
+ // expectEqual(s.size(), 1)
25
+ // expectFalse(s.empty())
26
+ // expectEqual(s[0], 42)
27
+ // }
28
+
29
+ runAllTests ( )
You can’t perform that action at this time.
0 commit comments