1 module boilerplate;
2 
3 public import boilerplate.accessors;
4 
5 public import boilerplate.autostring;
6 
7 public import boilerplate.constructor;
8 
9 public import boilerplate.conditions;
10 
11 enum GenerateAll = GenerateThis ~ GenerateToString ~ GenerateFieldAccessors ~ GenerateInvariants;
12 
13 @("can use all four generators at once")
14 unittest
15 {
16     import core.exception : AssertError;
17     import std.conv : to;
18     import unit_threaded.should : shouldEqual, shouldThrow;
19 
20     class Class
21     {
22         @ConstRead @Write @NonInit
23         int i_;
24 
25         mixin(GenerateAll);
26     }
27 
28     auto obj = new Class(5);
29 
30     obj.i.shouldEqual(5);
31     obj.to!string.shouldEqual("Class(i=5)");
32     obj.i(0).shouldThrow!AssertError;
33 }