Dunit 0.2

Ary Borenszweig ary at esperanto.org.ar
Sat Nov 8 13:11:25 PST 2008


Christopher Wright escribió:
> Introducing DUnit 0.2, with even more inconsistent capitalization!
> 
> Wow, it's been ages. I've been working off trunk so long I didn't 
> realize there was a 0.1 release.
> 
> Wow.
> 
> We've come a long way in the past eight months. About as long as I could 
> have come in two weeks, if I were paying attention mostly to dunit.
> 
> It's mostly been minor fixes to formatting, stability, that sort of 
> thing. That old bug where interfaces don't implicitly cast to Object 
> caused a fair number of headaches. But that's all water under the bridge 
> (for now).
> 
> I've added junit-esque xml output. If I can wade through the acre-feet 
> of XML required to create a build script that CruiseControl can handle, 
> dunit will have CC integration. I'd rather use CruiseControl.NET, but it 
> doesn't run well on Mono.
> 
> Dunit's assertions have improved a bit since our last release. Or so I 
> imagine. I can't recall at the moment exactly how.
> 
> And in the past day or so, with the talk of what people find lacking in 
> D's unittest{} blocks, I've been addressing a couple of the lacking 
> features in Dunit. For instance, you can get a list of tests that are 
> defined (useful for IDE integration -- like that'll ever happen) and 
> filter out tests based on a regular expression (or rather, filter them in).
> 
> So, yeah, check out the documentation, give it a spin, what have you. 
> The documentation's new and improved. Some longer examples would be 
> nice, I grant.
> 
> Anyway, here it is:
> http://dsource.org/projects/dmocks/wiki/DUnit -- wiki
> http://dsource.org/projects/dmocks/browser/downloads/dunit.0.2.zip?format=raw 
> -- direct download link

Cool!

I was looking at the source code with Descent, also to fix bugs in it, 
and found that if you import dunit.api and you mixin(DunitMain) than it 
works ok. But if you don't import dunit.api (if you use Descent, that 
will never get imported, but each separated module will), then you get 
an error because dunit.main is not found. The solution is to add imports 
in the mixins:

---
module dunit.attribute;

public const char[] DunitAutorunTest = `
         import dunit.main;
	unittest
	{
		dunit.main.ensure_main();
	}
`;

public deprecated const char[] DunitTest = ``;

public const char[] DunitIgnore = `
         import dunit.repository;
	static this ()
	{
		dunit.repository.Repository.instance.manager.noTests 
(typeof(this).classinfo);
	}
`;
	
public const char[] DunitMain = `
     import dunit.main;
     int main(char[][] args)
     {
         return dunit.main.dunit_main(args);
     }
`;
---

That fixes the error.

Nice work!


More information about the Digitalmars-d-announce mailing list