On Nov 28, 2007 2:34 AM, Xavier Hanin <[EMAIL PROTECTED]> wrote:

> [...]
> Moreover during this implementation I've also experimented with the new
> text representations, and added some tooling which I think can be pretty
> useful, and it's only the beginning. For example the unit test for the
> latest compatible conflict manager take advantage of the text representation
> and end up with tests like this:
>         /* Test data:
>             #A;1-> { #B;1.4 #C;[2.0,2.5] }
>             #B;1.4->#D;1.5
>             #C;2.5->#D;[1.0,1.6]
>          */
>         resolveAndAssert("ivy-latest-compatible-1.xml ", "#B;1.4, #C;2.5,
> #D;1.5");
>
> This is pretty easy to read from my point of view, and easy to write too.
> The assertion parsing the text representation is very productive, but what
> would be even better would be to able to convert the description of the test
> data in real test data, so that setting up a test case would be really easy.
> It'd be kind of a DSL for describing dependencies. Something like:
>        resolveAndAssert("#B;1.4, #C;2.5, #D;1.5",
>           "#A;1-> { #B;1.4 #C;[2.0,2.5] } "
>           + "#B;1.4->#D;1.5  "
>           + "#C;2.5->#D;[1.0,1.6]");
>

I've implemented a TestFixture to do something similar to what I was talking
about above:
    public void testCompatibilityResolve1() throws Exception {
        fixture
            .addMD("#A;1-> { #B;1.4 #C;[2.0,2.5] }")
            .addMD("#B;1.4->#D;1.5")
            .addMD("#C;2.5->#D;[1.0,1.6]")
            .addMD("#D;1.5").addMD("#D;1.6")
            .init();
        resolveAndAssert("#A;1", "#B;1.4, #C;2.5, #D;1.5");
    }

I'm pretty happy with the result, it's quite simple to write and read IMO.
I've called the text syntax used "micro ivy format".
I guess we could do some ResolveTest unit tests with that, but to really use
it in more places we'd need to find a syntax for configuration mapping and
artifact publication. So there's still room for future improvements!

Xavier
-- 
Xavier Hanin - Independent Java Consultant
http://xhab.blogspot.com/
http://ant.apache.org/ivy/
http://www.xoocode.org/

Reply via email to