www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.announce - Unittest Walker

reply Thomas Kuehne <thomas-dloop kuehne.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

If you are interested in executing all your unittests and don't
want to stop after the first failed one you might be interested
in the Unittest Walker.

sample output:
#
# testing some_module.__unittest1 ... SUCCESS
# testing some_module.__unittest2 ... FAILED: (Exception) just a sample
# testing some_module.__unittest3 ... SUCCESS
# Summary: 2/1/3 (succeeded/failed/total)
#

limitation:
works only on Linux

how to use:
1) download http://svn.dsource.org/projects/flectioned/downloads/flectioned.zip
2) gcc -c elf.c
3) dmd -unittest flectioned.d unittest_walker.d elf.o <your sources> -oftest
4) ./test

Thomas


-----BEGIN PGP SIGNATURE-----

iD8DBQFFeWhxLK5blCcjpWoRAtSvAJ4vqNbxLVyRqRcc37/MmbbjAUaUiwCfS/Ic
mTnC03JIOnAFUoZrAZphMGs=
=e7id
-----END PGP SIGNATURE-----
Dec 08 2006
parent reply Lutger <lutger.blijdestijn gmail.com> writes:
Thomas Kuehne wrote:
 -----BEGIN PGP SIGNED MESSAGE-----
 Hash: SHA1
 
 If you are interested in executing all your unittests and don't
 want to stop after the first failed one you might be interested
 in the Unittest Walker.
 
 sample output:
 #
 # testing some_module.__unittest1 ... SUCCESS
 # testing some_module.__unittest2 ... FAILED: (Exception) just a sample
 # testing some_module.__unittest3 ... SUCCESS
 # Summary: 2/1/3 (succeeded/failed/total)
 #
 
 limitation:
 works only on Linux
 
 how to use:
 1) download http://svn.dsource.org/projects/flectioned/downloads/flectioned.zip
 2) gcc -c elf.c
 3) dmd -unittest flectioned.d unittest_walker.d elf.o <your sources> -oftest
 4) ./test
 
 Thomas

Good idea, I'll try it whenever I get around to install linux. What about something like this: unittest("testing some stuff") { ... } or perhaps this is better: /// testing some stuff unittest {...} testing some_module: "testing some stuff" ... SUCCESS Is this possible / difficult?
Dec 08 2006
parent reply Thomas Kuehne <thomas-dloop kuehne.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Lutger schrieb am 2006-12-08:

<snip>

 Good idea, I'll try it whenever I get around to install linux. What 
 about something like this:

 unittest("testing some stuff")
 { ... }

 or perhaps this is better:

 /// testing some stuff
 unittest
 {...}

 testing some_module: "testing some stuff" ... SUCCESS


 Is this possible / difficult?

This would require compiler support. You can however use someting like this: # # unittest { # writefln("%s:%s %s", __FILE__, __LINE__, "your message here"); # ... # } # Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFFeXI+LK5blCcjpWoRAmW6AJ9vKcM49KgqtLjFGjDBykKFP21Y4wCfeF/7 tPLqVHkAt4pZMhM0skiZz+Q= =Nyci -----END PGP SIGNATURE-----
Dec 08 2006
parent Sean Kelly <sean f4.ca> writes:
Thomas Kuehne wrote:
 -----BEGIN PGP SIGNED MESSAGE-----
 Hash: SHA1
 
 Lutger schrieb am 2006-12-08:
 
 <snip>
 
 Good idea, I'll try it whenever I get around to install linux. What 
 about something like this:

 unittest("testing some stuff")
 { ... }

 or perhaps this is better:

 /// testing some stuff
 unittest
 {...}

 testing some_module: "testing some stuff" ... SUCCESS


 Is this possible / difficult?

This would require compiler support.

Could this be accomplished by modifying moduleinit.d in Phobos? It already contains a debug printf to output the module being tested. Sean
Dec 08 2006