File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed
test/Interop/Cxx/stdlib/overlay Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ extension std.string {
14
14
public init ( _ string: String ) {
15
15
self . init ( )
16
16
for char in string. utf8 {
17
- self . push_back ( value_type ( char) )
17
+ self . push_back ( value_type ( bitPattern : char) )
18
18
}
19
19
}
20
20
}
Original file line number Diff line number Diff line change @@ -19,6 +19,17 @@ StdStringOverlayTestSuite.test("std::string <=> Swift.String") {
19
19
20
20
let cxx3 : std . string = " literal "
21
21
expectEqual ( cxx3. size ( ) , 7 )
22
+
23
+ // Non-ASCII characters are represented by more than one CChar.
24
+ let cxx4 : std . string = " тест "
25
+ expectEqual ( cxx4. size ( ) , 8 )
26
+ let swift4 = String ( cxxString: cxx4)
27
+ expectEqual ( swift4, " тест " )
28
+
29
+ let cxx5 : std . string = " emoji_🤖 "
30
+ expectEqual ( cxx5. size ( ) , 10 )
31
+ let swift5 = String ( cxxString: cxx5)
32
+ expectEqual ( swift5, " emoji_🤖 " )
22
33
}
23
34
24
35
extension std . string . const_iterator : UnsafeCxxInputIterator {
You can’t perform that action at this time.
0 commit comments