File tree Expand file tree Collapse file tree 1 file changed +26
-1
lines changed Expand file tree Collapse file tree 1 file changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -82,8 +82,34 @@ $(H2 $(LNAME2 retained, Retained Features))
82
82
$(LI COM classes and C++ classes)
83
83
$(LI `assert` failures are directed to the C runtime library)
84
84
$(LI `switch` with strings)
85
+ $(LI `unittest`)
85
86
)
86
87
88
+ $(H3 $(LNAME2 unittests, Running unittests in `-betterC`))
89
+
90
+ While, testing can be done without the $(TT -betterC) flag, it is sometimes desirable to run the testsuite in `-betterC` too.
91
+ `unittest` blocks can be listed with the $(DDSUBLINK spec/traits, getUnitTests, `getUnitTests`) trait:
92
+
93
+ ---
94
+ unittest
95
+ {
96
+ assert(0);
97
+ }
98
+
99
+ extern(C) void main()
100
+ {
101
+ static foreach(u; __traits(getUnitTests, __traits(parent, main)))
102
+ u();
103
+ }
104
+ ---
105
+
106
+ $(CONSOLE
107
+ > dmd -betterC -unittest -run test.d
108
+ dmd_runpezoXK: foo.d:3: Assertion `0' failed.
109
+ )
110
+
111
+ However, in `-betterC` `assert` expressions don't use Druntime's assert and are directed to `assert` of the C runtime library instead.
112
+
87
113
$(H2 $(LNAME2 consequences, Unavailable Features))
88
114
89
115
$(P D features not available with $(B BetterC):)
98
124
$(LI `final switch`)
99
125
$(LI `synchronized` and $(MREF core, sync))
100
126
$(LI Static module constructors or destructors)
101
- $(LI `unittest` (testing can be done without the $(TT -betterC) flag))
102
127
)
103
128
104
129
You can’t perform that action at this time.
0 commit comments