FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Detecting main in a version(D_unittest)

 
Post new topic   Reply to topic     Forum Index -> Build
View previous topic :: View next topic  
Author Message
baxissimo



Joined: 23 Oct 2006
Posts: 241
Location: Tokyo, Japan

PostPosted: Sun Dec 17, 2006 10:55 pm    Post subject: Detecting main in a version(D_unittest) Reply with quote

bud doesn't seem to detect when there's a main() inside a version(D_unittest) block, despite the -unittest flag being passed in and that main being active.

Simple workaround is to use the -nolib flag, but would be nice if bud would catch it.
Back to top
View user's profile Send private message
Derek Parnell



Joined: 22 Apr 2004
Posts: 408
Location: Melbourne, Australia

PostPosted: Mon Dec 18, 2006 12:07 am    Post subject: Re: Detecting main in a version(D_unittest) Reply with quote

baxissimo wrote:
bud doesn't seem to detect when there's a main() inside a version(D_unittest) block, despite the -unittest flag being passed in and that main being active.

Simple workaround is to use the -nolib flag, but would be nice if bud would catch it.


D_unittest is not defined in the DigitalMars documentation. I do not know what it is.

The fault is not with Bud. For example, this works ...
Code:

version(dunittest)
{
    unittest
    {
        assert(0, "UT TEST");
    }
void main() {}
}


and compiled with ...

Code:

C:\temp>bud test -unittest -version=dunittest
Path and Version : y:\util\bud.exe v3.04(2512)
  built on Mon Oct 16 11:03:49 2006

C:\temp>test
Error: AssertError Failure test.d(6) UT TEST

C:\temp>


Speak with DigitalMars about the problem, I can't help you with this one.
_________________
--
Derek
skype name: derek.j.parnell
Back to top
View user's profile Send private message
baxissimo



Joined: 23 Oct 2006
Posts: 241
Location: Tokyo, Japan

PostPosted: Mon Dec 18, 2006 1:34 am    Post subject: My bad Reply with quote

You're right.
I'm going to have to chalk this one up to bad behavior of selective imports in DMD.
I had this in my code:
Code:

  if (D_unittest) {
     import std.stdio : writefln;
  }


And writefln's were working so I thought that D_unittest was getting selected.

But turns out that some other module I imported was doing an import std.stdio : writefln too. And unfortunately selective private imports aren't private. That's what you get from trying to avoid namespace pollution: more pollution than when you're lazy.

Sorry for the bogus report.
I'll erase the one I posted in the tracker too.

--bb
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> Build All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group