Run only "unittest", skip "main"

ketmar via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Jan 24 11:27:13 PST 2015


On Sat, 24 Jan 2015 11:11:35 -0800, H. S. Teoh via Digitalmars-d-learn
wrote:

> On Sat, Jan 24, 2015 at 07:02:35PM +0000, ketmar via Digitalmars-d-learn
> wrote:
>> On Sat, 24 Jan 2015 10:52:26 -0800, H. S. Teoh via Digitalmars-d-learn
>> wrote:
>> 
>> > On Sat, Jan 24, 2015 at 06:15:29PM +0000, tcak via
>> > Digitalmars-d-learn wrote:
>> >> Is there any way to run only unittest codes, and ignore main
>> >> function?
>> >> 
>> >> DMD is running both of them when I use -unittest.
>> > 
>> > version(unittest)
>> > {
>> > 	void main() {}
>> > }
>> > else {
>> > 	void main() { /* real main code here */ }
>> > }
>> 
>> real PITA and uglyness, btw.
> 
> I know.
> 
> One idea is to make `-main` automatically suppress any user-defined
> main, then you can compile with `dmd -main -unittest` to make it only
> run unittests.
> 
> But I don't know if the dmd devs will approve of that...

that would be very handy. i completely forgot about '-main' key for dmd. 
thank you, now i gone creating another nice patch. ;-)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20150124/733085ea/attachment.sig>


More information about the Digitalmars-d-learn mailing list