digitalmars.D.learn - Unit tests in libraries?
- Mike Linford (26/26) Aug 14 2010 Is this a bug? Unit tests do not seem to work in libraries. I'm using dm...
- Steven Schveighoffer (6/30) Aug 16 2010 Did you pass -unittest to dmd? It needs to be there when compiling the ...
- Mike Linford (5/46) Aug 16 2010 Haha, whoops, forgot to mention that I DID indeed include -unittest in
- Steven Schveighoffer (6/50) Aug 16 2010 Hm... I would say if -unittest is passed to the dmd -lib line, and you
Is this a bug? Unit tests do not seem to work in libraries. I'm using dmd
1.062 for linux.
mylib.d :
module mylib;
void blah()
{
}
unittest
{
assert(false);
}
main.d :
module main;
import mylib;
void main()
{
blah();
}
The unit test does not get run when compiled as:
dmd -lib mylib.d
dmd main.d mylib.a
But does get run when compiled as
dmd main.d mylib.d
Is this the intended behavior for unit tests in libraries?
--
Mike Linford
Aug 14 2010
On Sat, 14 Aug 2010 23:35:54 -0400, Mike Linford
<mike.linford.reg gmail.com> wrote:
Is this a bug? Unit tests do not seem to work in libraries. I'm using dmd
1.062 for linux.
mylib.d :
module mylib;
void blah()
{
}
unittest
{
assert(false);
}
main.d :
module main;
import mylib;
void main()
{
blah();
}
The unit test does not get run when compiled as:
dmd -lib mylib.d
dmd main.d mylib.a
But does get run when compiled as
dmd main.d mylib.d
Is this the intended behavior for unit tests in libraries?
Did you pass -unittest to dmd? It needs to be there when compiling the
file that contains unit tests.
I'm surprised unittests run at all with those compile lines.
-Steve
Aug 16 2010
On Mon, 16 Aug 2010 08:37:35 -0400, Steven Schveighoffer wrote:On Sat, 14 Aug 2010 23:35:54 -0400, Mike Linford <mike.linford.reg gmail.com> wrote:Haha, whoops, forgot to mention that I DID indeed include -unittest in all compile lines. -- Mike LinfordIs this a bug? Unit tests do not seem to work in libraries. I'm using dmd 1.062 for linux. mylib.d : module mylib; void blah() { } unittest { assert(false); } main.d : module main; import mylib; void main() { blah(); } The unit test does not get run when compiled as: dmd -lib mylib.d dmd main.d mylib.a But does get run when compiled as dmd main.d mylib.d Is this the intended behavior for unit tests in libraries?Did you pass -unittest to dmd? It needs to be there when compiling the file that contains unit tests. I'm surprised unittests run at all with those compile lines. -Steve
Aug 16 2010
On Mon, 16 Aug 2010 14:04:57 -0400, Mike Linford <mike.linford.reg gmail.com> wrote:On Mon, 16 Aug 2010 08:37:35 -0400, Steven Schveighoffer wrote:Hm... I would say if -unittest is passed to the dmd -lib line, and you don't get unit tests out of the resulting executable, you found a compiler bug! -SteveOn Sat, 14 Aug 2010 23:35:54 -0400, Mike Linford <mike.linford.reg gmail.com> wrote:Haha, whoops, forgot to mention that I DID indeed include -unittest in all compile lines.Is this a bug? Unit tests do not seem to work in libraries. I'm using dmd 1.062 for linux. mylib.d : module mylib; void blah() { } unittest { assert(false); } main.d : module main; import mylib; void main() { blah(); } The unit test does not get run when compiled as: dmd -lib mylib.d dmd main.d mylib.a But does get run when compiled as dmd main.d mylib.d Is this the intended behavior for unit tests in libraries?Did you pass -unittest to dmd? It needs to be there when compiling the file that contains unit tests. I'm surprised unittests run at all with those compile lines. -Steve
Aug 16 2010








"Steven Schveighoffer" <schveiguy yahoo.com>