"Fossies" - the Fresh Open Source Software Archive

Member "meson-0.52.1/test cases/d/6 unittest/app.d" (25 Aug 2018, 706 Bytes) of package /linux/privat/meson-0.52.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) D source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    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 }