Skip to content

Commit a14dfb1

Browse files
authored
[spec/unittest] Make 2 examples runnable (#4206)
1 parent 6c0fb4d commit a14dfb1

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

spec/unittest.dd

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ $(GNAME UnitTest):
3939
$(P For example, given a class $(D Sum) that is used to add two values, a unit
4040
test can be given:)
4141

42+
$(SPEC_RUNNABLE_EXAMPLE_COMPILE
4243
---
4344
class Sum
4445
{
@@ -52,6 +53,7 @@ $(GNAME UnitTest):
5253
}
5354
}
5455
---
56+
)
5557

5658
$(P When unit tests are enabled, the $(DDSUBLINK spec/version, PredefinedVersions, version identifier)
5759
$(D unittest) is predefined.
@@ -64,6 +66,7 @@ $(H2 $(LNAME2 attributes_unittest, Attributed Unittests))
6466
Such unittests are useful in verifying the given attribute(s) on a template
6567
function:)
6668

69+
$(SPEC_RUNNABLE_EXAMPLE_COMPILE
6770
---
6871
void myFunc(T)(T[] data)
6972
{
@@ -78,6 +81,7 @@ $(H2 $(LNAME2 attributes_unittest, Attributed Unittests))
7881
assert(arr == [2,2,3]);
7982
}
8083
---
84+
)
8185

8286
$(P This unittest verifies that $(D myFunc) contains only $(D @safe),
8387
`nothrow` code. Although this can also be accomplished by attaching these

0 commit comments

Comments
 (0)