Benoît Vidis
Benoît Vidis

Reputation: 3902

How to run unit tests with DSSS and GDC?

I am very new to D and still battling trying to configure my toolchain.

I am running Ubuntu Karmic and would like to use DSSS with GDC and Tango or TangoBos.

Till now, I installed GDC from Ubuntu repositories, DSSS, Tango and TangoBos from these repositories and I can compile using dsss + gdc + tangobos.

According to DSSS documentation, it should be possible to run the unit tests using

$ dsss build --test

but on my system, the --test argument is ignored. I have dsss last version (0.78) and its inline help does not include anything about unit tests.

Running ldc --unittest works fine (though I do not know exactly which libray it picks up).

Is there a way to run my unit tests using the same compiler & library than for compilation?

If so, is there a way to automate the testing or will I have to run it module per module?

Upvotes: 6

Views: 543

Answers (3)

Element Green
Element Green

Reputation: 442

I know this question is ancient, but it comes up prominently when searching on this issue.

I found that gdc works with the -funittest option, like this:

gdc -funittest -g -o unittest File1.d
./unittest

This will compile a single dlang file into an executable called unittest and then run the executable which will execute the unittest sections in the code and display any failed assertions.

Upvotes: 1

dkropfuntucht
dkropfuntucht

Reputation: 46

As best I can tell, sometime around Karmic, Ubuntu's install of gdc started ignoring arguments such as "--foo".

Observe:

$ gdc --not-a-real-option
gdc: no input files

vs.

$ gdc -not-a-real-option
gdc: unrecognized option '-not-a-real-option'
gdc: no input files

So on Lucid dsss version 0.76, gdc (Ubuntu 1:1.046-4.3.4-3ubuntu1) 4.3.4,

dsss build -test 

or

dsss build -unittest

should compile with unit tests

Upvotes: 3

opticron
opticron

Reputation: 1

I would use "dsss build -unittest". I haven't tried it, but I see it being used with a little googling.

Upvotes: 1

Related Questions