D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 6464 - Unittests in libraries isn't run
Summary: Unittests in libraries isn't run
Status: RESOLVED DUPLICATE of issue 4669
Alias: None
Product: D
Classification: Unclassified
Component: druntime (show other issues)
Version: D2
Hardware: Other Windows
: P2 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-10 03:30 UTC by simendsjo
Modified: 2011-08-10 03:49 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description simendsjo 2011-08-10 03:30:47 UTC
Ref: http://www.digitalmars.com/pnews/read.php?server=news.digitalmars.com&group=digitalmars.D.learn&artnum=28755

Is it possible to run unittests in libraries?
The following doesn't work:

l.d
===
module l;
import std.stdio;
int f() { return 1; } // just to make sure it's actually compiled in
unittest {
    writeln("Unittest from lib");
    assert(false);
}


t.d
===
import l;
import std.stdio;
void main() {
    writeln(f());
}


> dmd -unittest -lib l
> dmd -unittest t l.lib
> t.exe
1 // should write "Unittest from lib" and assert
Comment 1 Mike Parker 2011-08-10 03:49:56 UTC

*** This issue has been marked as a duplicate of issue 4669 ***