DS3
Gregor Richards
Richards at codu.org
Mon Aug 27 09:24:55 PDT 2007
David B. Held wrote:
> torhu wrote:
>> [...]
>> If you just want to build an app, you can just do 'rebuild myapp',
>> rebuild works the same way as bud does. It will then parse a file
>> called myapp.d, and compile and link everything by looking at the
>> import statements to find the other files needed. The output will be
>> 'myapp.exe'. Can't get much easier. Additional compiler arguments,
>> libs, etc. can be added to rebuild's command line unaltered.
>> [...]
>
> Well, I haven't used rebuild or bud either. ;) This still doesn't work
> for my app, because I'm not actually building an app...I'm building a
> library with unit tests. So I have a main(), but it doesn't do anything
> interesting, and I don't need to import any modules from the library,
> because I normally just add those in by hand. Since unit tests are
> global functions that get called magically, you can have a disjoint
> import lattice that might be confusing rebuild. Here is a sample that
> will confuse dsss:
>
> main.d:
> module main;
> void main() { }
>
> lib.d:
> module lib;
> import std.stdio;
> unittest
> {
> writefln("Hello, world!");
> }
>
> Now, tell me what you expect to happen when you do 'dsss build
> -unittest', and tell me what does happen.
>
> Dave
>
> P.S. Normally, I would just do 'dmd main lib -unittest', and it would
> just work (well, it *does* work). I was hoping dsss was this easy, but
> I think I found a corner case.
OK, two things.
1) You usually need a dsss.conf. Mind you, it shouldn't have spewed
random output, but all that DSSS does is say "any package is probably a
library" when it's figuring it out automatically. As I posted in some
other NG (or was it this one :) ), that needs improvement.
2) You don't need an empty main to run unit tests with DSSS.
So,
First, make a dsss.conf that looks something like this:
name = <somename>
[lib.d]
type = library
Then, run unit tests like this:
dsss build --test
- Gregor Richards
More information about the Digitalmars-d
mailing list