digitalmars.D - Unit tests in libraries?
- Mike Linford (28/28) Aug 16 2010 Sorry for the repost, but its been more than 24 hours in
- Walter Bright (2/8) Aug 16 2010 You need to compile with -unittest to run them.
- Mike Linford (5/14) Aug 16 2010 Sorry, I forgot to include that I DID include -unittest in all compile
- Mike Linford (7/16) Aug 16 2010 Also, the following creates a library that does run the unit tests:
- Walter Bright (2/17) Aug 16 2010 Right, that's working as it should.
- Mike Linford (6/24) Aug 16 2010 Is it working as it should by not including the unit tests with:
- Walter Bright (2/7) Aug 16 2010 That should work.
- Mike Linford (35/43) Aug 16 2010 Yeah, I'm not sure what I'm doing wrong. Can someone else try this out?
- Stephan (3/44) Aug 17 2010 Yeah unittests in compiled static librarys do not work as of dmd2048
- Mike Linford (4/60) Aug 17 2010 Done. http://d.puremagic.com/issues/show_bug.cgi?id=4669
Sorry for the repost, but its been more than 24 hours in digitalmars.D.learn 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 16 2010
Mike Linford wrote: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.dYou need to compile with -unittest to run them.
Aug 16 2010
On Mon, 16 Aug 2010 10:26:46 -0700, Walter Bright wrote:Mike Linford wrote:Sorry, I forgot to include that I DID include -unittest in all compile lines. -- Mike LinfordThe 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.dYou need to compile with -unittest to run them.
Aug 16 2010
On Mon, 16 Aug 2010 10:26:46 -0700, Walter Bright wrote:Mike Linford wrote:Also, the following creates a library that does run the unit tests: dmd -c -unittest mylib.d ar -rc mylib.a mylib.o dmd -unittest main.d mylib.a -- Mike LinfordThe 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.dYou need to compile with -unittest to run them.
Aug 16 2010
Mike Linford wrote:On Mon, 16 Aug 2010 10:26:46 -0700, Walter Bright wrote:Right, that's working as it should.Mike Linford wrote:Also, the following creates a library that does run the unit tests: dmd -c -unittest mylib.d ar -rc mylib.a mylib.o dmd -unittest main.d mylib.aThe 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.dYou need to compile with -unittest to run them.
Aug 16 2010
On Mon, 16 Aug 2010 11:22:50 -0700, Walter Bright wrote:Mike Linford wrote:Is it working as it should by not including the unit tests with: dmd -unittest -lib mylib.d ? -- Mike LinfordOn Mon, 16 Aug 2010 10:26:46 -0700, Walter Bright wrote:Right, that's working as it should.Mike Linford wrote:Also, the following creates a library that does run the unit tests: dmd -c -unittest mylib.d ar -rc mylib.a mylib.o dmd -unittest main.d mylib.aThe 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.dYou need to compile with -unittest to run them.
Aug 16 2010
Mike Linford wrote:Is it working as it should by not including the unit tests with: dmd -unittest -lib mylib.d ?That should work.
Aug 16 2010
On Mon, 16 Aug 2010 17:38:28 -0700, Walter Bright wrote:Mike Linford wrote:Yeah, I'm not sure what I'm doing wrong. Can someone else try this out? mylib.d: 1 module mylib; 2 3 void blah() 4 { 5 } 6 unittest 7 { 8 assert(false); 9 } 10 test.d: 1 module test; 2 3 import mylib; 4 5 void main() 6 { 7 blah(); 8 } 9 Makefile: 1 test : mylib.a test.d 2 dmd -unittest test.d mylib.a 3 4 mylib.a : mylib.d 5 dmd -unittest -lib mylib.d 6 7 clean : 8 rm -f test mylib.a *.o 9 -- Mike LinfordIs it working as it should by not including the unit tests with: dmd -unittest -lib mylib.d ?That should work.
Aug 16 2010
Yeah unittests in compiled static librarys do not work as of dmd2048 right now. please file a bug report with that code. On 17.08.2010 04:24, Mike Linford wrote:On Mon, 16 Aug 2010 17:38:28 -0700, Walter Bright wrote:Mike Linford wrote:Yeah, I'm not sure what I'm doing wrong. Can someone else try this out? mylib.d: 1 module mylib; 2 3 void blah() 4 { 5 } 6 unittest 7 { 8 assert(false); 9 } 10 test.d: 1 module test; 2 3 import mylib; 4 5 void main() 6 { 7 blah(); 8 } 9 Makefile: 1 test : mylib.a test.d 2 dmd -unittest test.d mylib.a 3 4 mylib.a : mylib.d 5 dmd -unittest -lib mylib.d 6 7 clean : 8 rm -f test mylib.a *.o 9Is it working as it should by not including the unit tests with: dmd -unittest -lib mylib.d ?That should work.
Aug 17 2010
On Tue, 17 Aug 2010 12:38:32 +0200, Stephan wrote:Yeah unittests in compiled static librarys do not work as of dmd2048 right now. please file a bug report with that code. On 17.08.2010 04:24, Mike Linford wrote:Done. http://d.puremagic.com/issues/show_bug.cgi?id=4669 -- Mike LinfordOn Mon, 16 Aug 2010 17:38:28 -0700, Walter Bright wrote:Mike Linford wrote:Yeah, I'm not sure what I'm doing wrong. Can someone else try this out? mylib.d: 1 module mylib; 2 3 void blah() 4 { 5 } 6 unittest 7 { 8 assert(false); 9 } 10 test.d: 1 module test; 2 3 import mylib; 4 5 void main() 6 { 7 blah(); 8 } 9 Makefile: 1 test : mylib.a test.d 2 dmd -unittest test.d mylib.a 3 4 mylib.a : mylib.d 5 dmd -unittest -lib mylib.d 6 7 clean : 8 rm -f test mylib.a *.o 9Is it working as it should by not including the unit tests with: dmd -unittest -lib mylib.d ?That should work.
Aug 17 2010