This repository was archived by the owner on Oct 12, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +20
-4
lines changed Expand file tree Collapse file tree 2 files changed +20
-4
lines changed Original file line number Diff line number Diff line change @@ -95,10 +95,22 @@ private string miniFormat(V)(const scope ref V v)
95
95
}
96
96
else static if (__traits(isIntegral, V))
97
97
{
98
- enum printfFormat = getPrintfFormat! V;
99
- char [20 ] val;
100
- const len = sprintf(&val[0 ], printfFormat, v);
101
- return val.idup[0 .. len];
98
+ static if (is (V == char ))
99
+ {
100
+ return [' \' ' , v, ' \' ' ];
101
+ }
102
+ else static if (is (V == wchar ) || is (V == dchar ))
103
+ {
104
+ import core.internal.utf : toUTF8;
105
+ return toUTF8 ([' \' ' , v, ' \' ' ]);
106
+ }
107
+ else
108
+ {
109
+ enum printfFormat = getPrintfFormat! V;
110
+ char [20 ] val;
111
+ const len = sprintf(&val[0 ], printfFormat, v);
112
+ return val.idup[0 .. len];
113
+ }
102
114
}
103
115
else static if (__traits(isFloating, V))
104
116
{
Original file line number Diff line number Diff line change @@ -63,6 +63,10 @@ void testStrings()
63
63
// https://issues.dlang.org/show_bug.cgi?id=20322
64
64
test(" left" w, " right" w, ` "left" != "right"` );
65
65
test(" left" d, " right" d, ` "left" != "right"` );
66
+
67
+ test(' A' , ' B' , " 'A' != 'B'" );
68
+ test(wchar (' ❤' ), wchar (' ∑' ), " '❤' != '∑'" );
69
+ test(dchar (' ❤' ), dchar (' ∑' ), " '❤' != '∑'" );
66
70
}
67
71
68
72
void testToString ()()
You can’t perform that action at this time.
0 commit comments