www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - unit testing

reply "sleek" <cslush gmail.com> writes:
Can anyone explain to me the proper way to put a unittest { ... } block into 
my code so that the only time unit tests get compiled and run is if I'm in a 
release mode?

I thought that I could simply compile with:

dmd -release mymodule.d

However, when I run the resulting executable the unit tests are getting 
executed. I can wrap the unittest { ... } block in a debug { ... } block, 
but is this really the best way?

Thanks for the help 
Jul 15 2008
parent reply "sleek" <cslush gmail.com> writes:
Sorry, it seems that the dmd is not the problem here. In fact, what was 
being executed was the following:

dsss build mymodule.d -release

This seems to be compiling unit tests in all the time. I'm not sure why. Can 
anyone help with this?

"sleek" <cslush gmail.com> wrote in message 
news:g5jmrt$eaf$1 digitalmars.com...
 Can anyone explain to me the proper way to put a unittest { ... } block 
 into my code so that the only time unit tests get compiled and run is if 
 I'm in a release mode?

 I thought that I could simply compile with:

 dmd -release mymodule.d

 However, when I run the resulting executable the unit tests are getting 
 executed. I can wrap the unittest { ... } block in a debug { ... } block, 
 but is this really the best way?

 Thanks for the help
 

Jul 15 2008
next sibling parent reply "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
"sleek" <cslush gmail.com> wrote in message 
news:g5jo61$h1m$1 digitalmars.com...
 Sorry, it seems that the dmd is not the problem here. In fact, what was 
 being executed was the following:

 dsss build mymodule.d -release

 This seems to be compiling unit tests in all the time. I'm not sure why. 
 Can anyone help with this?

Does your dsss.conf file have the -unittest flag in it? If so, that's why.
Jul 16 2008
parent reply "sleek" <cslush gmail.com> writes:
I discovered this to be user error. I didn't realize that dsss was creating 
a "dsss_objs" folder. For whatever reason, I couldn't simply do a "dsss 
build mymodule.d" and have it cleanly create a new instance. I guess I need 
to do a "dsss clean" before rebuilding. Thanks for the help Jarret

"Jarrett Billingsley" <kb3ctd2 yahoo.com> wrote in message 
news:g5kqsl$313f$1 digitalmars.com...
 "sleek" <cslush gmail.com> wrote in message 
 news:g5jo61$h1m$1 digitalmars.com...
 Sorry, it seems that the dmd is not the problem here. In fact, what was 
 being executed was the following:

 dsss build mymodule.d -release

 This seems to be compiling unit tests in all the time. I'm not sure why. 
 Can anyone help with this?

Does your dsss.conf file have the -unittest flag in it? If so, that's why.

Jul 19 2008
parent reply "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
"sleek" <cslush gmail.com> wrote in message 
news:g5u57t$1i6n$1 digitalmars.com...
I discovered this to be user error. I didn't realize that dsss was creating 
a "dsss_objs" folder. For whatever reason, I couldn't simply do a "dsss 
build mymodule.d" and have it cleanly create a new instance. I guess I need 
to do a "dsss clean" before rebuilding. Thanks for the help Jarret

Alternatively, you can do "dsss build -full mymodule.d". That forces a full rebuild. And it's Jarrett with two Ts.
Jul 19 2008
next sibling parent reply "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
"Jarrett Billingsley" <kb3ctd2 yahoo.com> wrote in message 
news:g5ufre$264o$1 digitalmars.com...
 "sleek" <cslush gmail.com> wrote in message 
 news:g5u57t$1i6n$1 digitalmars.com...
I discovered this to be user error. I didn't realize that dsss was 
creating a "dsss_objs" folder. For whatever reason, I couldn't simply do a 
"dsss build mymodule.d" and have it cleanly create a new instance. I guess 
I need to do a "dsss clean" before rebuilding. Thanks for the help Jarret

Alternatively, you can do "dsss build -full mymodule.d". That forces a full rebuild. And it's Jarrett with two Ts.

And everyone, I mean *everyone* misspells it the wrong way. It's like a conspiracy.
Jul 19 2008
next sibling parent "Koroskin Denis" <2korden gmail.com> writes:
On Sun, 20 Jul 2008 08:44:54 +0400, Jarrett Billingsley  
<kb3ctd2 yahoo.com> wrote:

 And everyone, I mean *everyone* misspells it the wrong way.  It's like a
 conspiracy.

Don't pay attention to that, Jarett :)
Jul 20 2008
prev sibling parent reply Don <nospam nospam.com.au> writes:
Jarrett Billingsley wrote:
 "Jarrett Billingsley" <kb3ctd2 yahoo.com> wrote in message 
 news:g5ufre$264o$1 digitalmars.com...
 "sleek" <cslush gmail.com> wrote in message 
 news:g5u57t$1i6n$1 digitalmars.com...
 I discovered this to be user error. I didn't realize that dsss was 
 creating a "dsss_objs" folder. For whatever reason, I couldn't simply do a 
 "dsss build mymodule.d" and have it cleanly create a new instance. I guess 
 I need to do a "dsss clean" before rebuilding. Thanks for the help Jarret

full rebuild. And it's Jarrett with two Ts.

And everyone, I mean *everyone* misspells it the wrong way. It's like a conspiracy.

200 different ways that people have got it wrong. Including several on official documents.
Jul 22 2008
parent reply "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
"Don" <nospam nospam.com.au> wrote in message 
news:g64mge$200f$1 digitalmars.com...
 Jarrett Billingsley wrote:
 "Jarrett Billingsley" <kb3ctd2 yahoo.com> wrote in message 
 news:g5ufre$264o$1 digitalmars.com...
 "sleek" <cslush gmail.com> wrote in message 
 news:g5u57t$1i6n$1 digitalmars.com...
 I discovered this to be user error. I didn't realize that dsss was 
 creating a "dsss_objs" folder. For whatever reason, I couldn't simply 
 do a "dsss build mymodule.d" and have it cleanly create a new instance. 
 I guess I need to do a "dsss clean" before rebuilding. Thanks for the 
 help Jarret

full rebuild. And it's Jarrett with two Ts.

And everyone, I mean *everyone* misspells it the wrong way. It's like a conspiracy.

different ways that people have got it wrong. Including several on official documents.

Wow, I get my last name misspelled too but not quite that diversely. You wouldn't think "Clugston" would give people that much trouble.
Jul 22 2008
next sibling parent reply Ary Borenszweig <ary esperanto.org.ar> writes:
Jarrett Billingsley a écrit :
 "Don" <nospam nospam.com.au> wrote in message 
 news:g64mge$200f$1 digitalmars.com...
 Jarrett Billingsley wrote:
 "Jarrett Billingsley" <kb3ctd2 yahoo.com> wrote in message 
 news:g5ufre$264o$1 digitalmars.com...
 "sleek" <cslush gmail.com> wrote in message 
 news:g5u57t$1i6n$1 digitalmars.com...
 I discovered this to be user error. I didn't realize that dsss was 
 creating a "dsss_objs" folder. For whatever reason, I couldn't simply 
 do a "dsss build mymodule.d" and have it cleanly create a new instance. 
 I guess I need to do a "dsss clean" before rebuilding. Thanks for the 
 help Jarret

full rebuild. And it's Jarrett with two Ts.

conspiracy.

different ways that people have got it wrong. Including several on official documents.

Wow, I get my last name misspelled too but not quite that diversely. You wouldn't think "Clugston" would give people that much trouble.

Please don't complain about complicated last names. :-P
Jul 22 2008
parent "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
"Ary Borenszweig" <ary esperanto.org.ar> wrote in message 
news:g660fr$2156$1 digitalmars.com...
 Jarrett Billingsley a écrit :
 "Don" <nospam nospam.com.au> wrote in message 
 news:g64mge$200f$1 digitalmars.com...
 Jarrett Billingsley wrote:
 "Jarrett Billingsley" <kb3ctd2 yahoo.com> wrote in message 
 news:g5ufre$264o$1 digitalmars.com...
 "sleek" <cslush gmail.com> wrote in message 
 news:g5u57t$1i6n$1 digitalmars.com...
 I discovered this to be user error. I didn't realize that dsss was 
 creating a "dsss_objs" folder. For whatever reason, I couldn't simply 
 do a "dsss build mymodule.d" and have it cleanly create a new 
 instance. I guess I need to do a "dsss clean" before rebuilding. 
 Thanks for the help Jarret

a full rebuild. And it's Jarrett with two Ts.

a conspiracy.

200 different ways that people have got it wrong. Including several on official documents.

Wow, I get my last name misspelled too but not quite that diversely. You wouldn't think "Clugston" would give people that much trouble.

Please don't complain about complicated last names. :-P

O_O
Jul 22 2008
prev sibling parent reply Don <nospam nospam.com.au> writes:
Jarrett Billingsley wrote:
 "Don" <nospam nospam.com.au> wrote in message 
 news:g64mge$200f$1 digitalmars.com...
 Jarrett Billingsley wrote:
 "Jarrett Billingsley" <kb3ctd2 yahoo.com> wrote in message 
 news:g5ufre$264o$1 digitalmars.com...
 "sleek" <cslush gmail.com> wrote in message 
 news:g5u57t$1i6n$1 digitalmars.com...
 I discovered this to be user error. I didn't realize that dsss was 
 creating a "dsss_objs" folder. For whatever reason, I couldn't simply 
 do a "dsss build mymodule.d" and have it cleanly create a new instance. 
 I guess I need to do a "dsss clean" before rebuilding. Thanks for the 
 help Jarret

full rebuild. And it's Jarrett with two Ts.

conspiracy.

different ways that people have got it wrong. Including several on official documents.

Wow, I get my last name misspelled too but not quite that diversely. You wouldn't think "Clugston" would give people that much trouble.

Gwgston, Cluster, Augsta, Klaxton, Coueston, Clipson, McClugston, ... And three different variants in one school report. Every teacher spelt it differently. My favourite was for my grandfather: a commemorative plaque to Mr Plugphon for 35 years of service as the former CEO. Ary must have a really hard time.
Jul 23 2008
parent reply Sean Kelly <sean invisibleduck.org> writes:
Don wrote:
 Jarrett Billingsley wrote:
 "Don" <nospam nospam.com.au> wrote in message 
 news:g64mge$200f$1 digitalmars.com...
 Jarrett Billingsley wrote:
 "Jarrett Billingsley" <kb3ctd2 yahoo.com> wrote in message 
 news:g5ufre$264o$1 digitalmars.com...
 "sleek" <cslush gmail.com> wrote in message 
 news:g5u57t$1i6n$1 digitalmars.com...
 I discovered this to be user error. I didn't realize that dsss was 
 creating a "dsss_objs" folder. For whatever reason, I couldn't 
 simply do a "dsss build mymodule.d" and have it cleanly create a 
 new instance. I guess I need to do a "dsss clean" before 
 rebuilding. Thanks for the help Jarret

forces a full rebuild. And it's Jarrett with two Ts.

like a conspiracy.

200 different ways that people have got it wrong. Including several on official documents.

Wow, I get my last name misspelled too but not quite that diversely. You wouldn't think "Clugston" would give people that much trouble.

Gwgston, Cluster, Augsta, Klaxton, Coueston, Clipson, McClugston, ... And three different variants in one school report. Every teacher spelt it differently. My favourite was for my grandfather: a commemorative plaque to Mr Plugphon for 35 years of service as the former CEO.

But those aren't even spelling errors--they're entirely different names! And I thought having people pronounce my name as "seen" was bad (yes, teachers too). Sean
Jul 23 2008
parent Ary Borenszweig <ary esperanto.org.ar> writes:
Sean Kelly a écrit :
 Don wrote:
 Jarrett Billingsley wrote:
 "Don" <nospam nospam.com.au> wrote in message 
 news:g64mge$200f$1 digitalmars.com...
 Jarrett Billingsley wrote:
 "Jarrett Billingsley" <kb3ctd2 yahoo.com> wrote in message 
 news:g5ufre$264o$1 digitalmars.com...
 "sleek" <cslush gmail.com> wrote in message 
 news:g5u57t$1i6n$1 digitalmars.com...
 I discovered this to be user error. I didn't realize that dsss 
 was creating a "dsss_objs" folder. For whatever reason, I 
 couldn't simply do a "dsss build mymodule.d" and have it cleanly 
 create a new instance. I guess I need to do a "dsss clean" before 
 rebuilding. Thanks for the help Jarret

forces a full rebuild. And it's Jarrett with two Ts.

like a conspiracy.

than 200 different ways that people have got it wrong. Including several on official documents.

Wow, I get my last name misspelled too but not quite that diversely. You wouldn't think "Clugston" would give people that much trouble.

Gwgston, Cluster, Augsta, Klaxton, Coueston, Clipson, McClugston, ... And three different variants in one school report. Every teacher spelt it differently. My favourite was for my grandfather: a commemorative plaque to Mr Plugphon for 35 years of service as the former CEO.

But those aren't even spelling errors--they're entirely different names! And I thought having people pronounce my name as "seen" was bad (yes, teachers too). Sean

My name (Ary) is pretty uncommon here in Argentina. But the name "Ariel" is somewhat common and people use "Ary" as a shorthand for "Ariel". So people not only get the spelling of my last name wrong, they also fight with my name. I say "Hola, soy Ary" and they say "Ariel?", "No, Ary", "Ariel?", etc., or they just suppose I'm Ariel and later they call me like that. :-P
Jul 24 2008
prev sibling parent "sleek" <cslush gmail.com> writes:
Awesome! Nice dsss tip.

Thanks Jared! :-P

"Jarrett Billingsley" <kb3ctd2 yahoo.com> wrote in message 
news:g5ufre$264o$1 digitalmars.com...
 "sleek" <cslush gmail.com> wrote in message 
 news:g5u57t$1i6n$1 digitalmars.com...
I discovered this to be user error. I didn't realize that dsss was 
creating a "dsss_objs" folder. For whatever reason, I couldn't simply do a 
"dsss build mymodule.d" and have it cleanly create a new instance. I guess 
I need to do a "dsss clean" before rebuilding. Thanks for the help Jarret

Alternatively, you can do "dsss build -full mymodule.d". That forces a full rebuild. And it's Jarrett with two Ts.

Jul 23 2008
prev sibling next sibling parent "Anders Bergh" <anders1 gmail.com> writes:
On Sun, Jul 20, 2008 at 6:44 AM, Jarret Billingsley <kb3ctd2 yahoo.com> wrote:
 "Jarret Billingsley" <kb3ctd2 yahoo.com> wrote in message
 news:g5ufre$264o$1 digitalmars.com...
 "sleek" <cslush gmail.com> wrote in message
 news:g5u57t$1i6n$1 digitalmars.com...
I discovered this to be user error. I didn't realize that dsss was
creating a "dsss_objs" folder. For whatever reason, I couldn't simply do a
"dsss build mymodule.d" and have it cleanly create a new instance. I guess
I need to do a "dsss clean" before rebuilding. Thanks for the help Jarrett

Alternatively, you can do "dsss build -full mymodule.d". That forces a full rebuild. And it's Jarret with one T.

And everyone, I mean *everyone* misspells it the wrong way. It's like a conspiracy.

Don't worry, at least I know how to spell your name, Jarret! -- Anders
Jul 20 2008
prev sibling parent "Bill Baxter" <wbaxter gmail.com> writes:
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

On Thu, Jul 24, 2008 at 10:25 AM, sleek <cslush gmail.com> wrote:

 Awesome! Nice dsss tip.

 Thanks Jared! :-P

 "Jarrett Billingsley" <kb3ctd2 yahoo.com> wrote in message
 news:g5ufre$264o$1 digitalmars.com...
 "sleek" <cslush gmail.com> wrote in message
 news:g5u57t$1i6n$1 digitalmars.com...
I discovered this to be user error. I didn't realize that dsss was
creating a "dsss_objs" folder. For whatever reason, I couldn't simply do


"dsss build mymodule.d" and have it cleanly create a new instance. I


I need to do a "dsss clean" before rebuilding. Thanks for the help Jarret

Alternatively, you can do "dsss build -full mymodule.d". That forces a full rebuild. And it's Jarrett with two Ts.


If you change the dsss.conf file, DSSS will detect that and do a full rebuild. But if other things change out from under it (like library versions or sometimes code) then you will need a -full / or clean. It isn't like SCONS, which keeps an md5 hash of dependencies to detect any changes that might affect a build. --bb
Jul 23 2008