D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 20528 - Stray unit test in phobos is run by user code compiled with -unittest
Summary: Stray unit test in phobos is run by user code compiled with -unittest
Status: RESOLVED INVALID
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: All All
: P1 minor
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-01-23 13:52 UTC by Steven Schveighoffer
Modified: 2020-01-23 14:27 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Steven Schveighoffer 2020-01-23 13:52:33 UTC
Using writefln causes a unittest to be pulled in from Phobos into user code.

example:

-------
import std.stdio;

void main()
{
   writefln("hello");
}
--------


dmd -run -unittest app.d
1 unittests passed

Phobos should not be inserting unittests into user's code.

See related issue 20500
Comment 1 Steven Schveighoffer 2020-01-23 14:27:55 UTC
Oops, Rainer already fixed this: https://github.com/dlang/phobos/pull/7359