Debian Codegraph @

test cases/d/6 unittest/app.d

raw
1
2 import std.stdio;
3
4 uint getFour ()
5 {
6 auto getTwo ()
7 {
8 return 1 + 1;
9 }
10
11 return getTwo () + getTwo ();
12 }
13
14 void main ()
15 {
16 import core.stdc.stdlib : exit;
17
18 writeln ("Four: ", getFour ());
19 exit (4);
20 }
21
22 unittest
23 {
24 writeln ("TEST");
25 import core.stdc.stdlib : exit;
26 import second_unit;
27
28 assert (getFour () > 2);
29 assert (getFour () == 4);
30
31 // this is a regression test for https://github.com/mesonbuild/meson/issues/3337
32 secondModuleTestFunc ();
33
34 // we explicitly terminate here to give the unittest program a different exit
35 // code than the main application has.
36 // (this prevents the regular main() from being executed)
37 exit (0);
38 }