[Issue 11362] Unit test assertion failure messages not printed

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Oct 27 23:56:19 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=11362



--- Comment #4 from Ali Cehreli <acehreli at yahoo.com> 2013-10-27 23:56:18 PDT ---
Well, this is broken on git head then. The following session compares two
programs with a single assert expression.

One has it in main:

good.d:

void main()
{
    assert(false, "something is wrong");
}

The other has it in a unittest block:

unittest
{
    assert(false, "something is wrong");
}

void main()
{}

Under Linux (SL6), the former prints both the assertion failure message and the
stack trace; the latter does not do any of that. The consolation is that the
latter returns a non-zero error code.

Here is my interaction:

$ ./wbd | grep DMD
DMD64 D Compiler v2.064-devel-acc0cb0
$ cat good.d
void main()
{
    assert(false, "something is wrong");
}
$ ./wbd good.d
$ ./good
core.exception.AssertError at good.d(3): something is wrong
----------------
./good() [0x401a65]
./good() [0x4019c1]
./good() [0x401ecc]
./good() [0x401c8e]
./good() [0x401e8b]
./good() [0x401c8e]
./good() [0x401c0f]
./good() [0x4019e3]
/lib64/libc.so.6(__libc_start_main+0xfd) [0x301621ecdd]
$ echo $?
1
$ cat bad.d
unittest
{
    assert(false, "something is wrong");
}

void main()
{}
$ ./wbd bad.d -unittest
$ ./bad
$ echo $?
1

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list