Debian Codegraph @

libphobos/testsuite/libphobos.phobos/std_demangle.d

raw
1 @safe pure unittest
2 {
3 import std.demangle;
4
5 // int b in module a
6 assert(demangle("_D1a1bi") == "int a.b");
7 // char array foo in module test
8 assert(demangle("_D4test3fooAa") == "char[] test.foo");
9 }
10
11 @system unittest
12 {
13 import std.demangle;
14
15 import std.ascii : isAlphaNum;
16 import std.algorithm.iteration : chunkBy, joiner, map;
17 import std.algorithm.mutation : copy;
18 import std.conv : to;
19 import std.demangle : demangle;
20 import std.functional : pipe;
21 import std.stdio : stdin, stdout;
22
23 void main()
24 {
25 stdin.byLineCopy
26 .map!(
27 l => l.chunkBy!(a => isAlphaNum(a) || a == '_')
28 .map!(a => a[1].pipe!(to!string, demangle)).joiner
29 )
30 .copy(stdout.lockingTextWriter);
31 }
32 }
33