1 module nogc;
2 
3 public import nogc.conv;
4 public import nogc.exception;
5 
6 version(unitThreadedLight):
7 
8 // text is @system because it returns a slice to a static array
9 // if you need to store the string you'll need to make a copy
10 // since consecutive calls will return the same slice and it will
11 // be mutated
12 @nogc @system unittest {
13     import nogc.conv: text;
14     // works with basic types and user defined structs/classes
15     assert(text(1, " ", "foo", " ", 2.0) == "1 foo 2.000000");
16 }
17 
18 
19 // enforce is @safe, since it internally makes a call to `text` but
20 // immediately throws an exception, and casting it to `string` makes
21 // it immutable. Ugly but it works.
22 @nogc @safe unittest {
23     import nogc.exception: enforce;
24     import nogc.conv: text;
25     const expected = 1;
26     const actual = 1;
27     enforce(actual == expected, "Expected: ", expected, " but got: ", actual);
28 }