On Sat, Feb 16, 2013 at 5:30 PM, Nick Wellnhofer <[email protected]> wrote:
> See my new branch 'clownfish-test-v2' for a solution based on this idea. I
> agree that it's better than my previous approach.

I like the new branch very much.  Thank you for taking the time to refine it.

> OK, I thought a TestCase was a single "assertion". If it's equivalent to a
> test script, I didn't understand the xUnit terminology.

Interesting -- that's the same misunderstanding I had when I first encountered
xUnit.

>> `STR_EQ` is good as implemented in CFC, but the main string type in Clownfish
>> is an object (named "CharBuf" at this time) rather than a NUL-terminated C
>> string.  If we have `STR_EQ` take two CharBuf objects, we'll find a lot more
>> use for it.
>
> Maybe we should have STR_EQ, CB_EQ and even CB_EQ_STR?

For a number of reasons, Clownfish needs an immutable string type, which I
think should be named Clownfish::String.  CharBuf would become a mutable
subclass of String (and would be significantly rarer than it is now).

I'll omit the rationale since that's a long tangent, and as of this moment I
don't intend to prioritize work on an immutable string type until after we
have at least Python and Ruby bindings -- but I'd like to stake a claim on the
high-value "str" abbreviation for Clownfish::String.

How about CSTR_EQ for C strings and STR_EQ for CharBufs (and eventually,
Clownfish::Strings)?

IMO, claiming primacy for CharBufs over C strings is already justified based
on stats:

    $ grep -pir "cb_equals\b" core/Lucy/Test/ | wc -l
          58
    $ grep -pir "cb_equals_str\b" core/Lucy/Test/ | wc -l
          42
    $ grep -pir "str_eq\b" core/Lucy/Test/ | wc -l
           3

Or alternatively, can we punt and define the three test macros you enumerate
above in Lucy::Test but not Clownfish::Test?

> In the CFC tests, the printf-style is used quite a lot. IMO it's quite
> convenient so I'd like to keep it.

I'd thought the printf-style would have been taken advantage of more often,
but on inspection I think there were 4 usages total between the Charmonizer
test suite and the Lucy test suite.  I'm a little surprised that you actually
used it more in CFC's tests.

> My main concern for now is to adapt the tests for the C bindings.  My second
> approach in 'clownfish-test-v2' is less invasive than the first one and to
> be honest I lost a bit of my enthusiasm of making bigger changes to the test
> infrastructure ;)

Hmm, I hope the give-and-take of consensus building hasn't been too
demotivating. :\  If it's just coding fatigue, though, then congratulations on
getting a huge amount done before burning out.  I'm happy to do some work on
this area, and we might be able to queue up some easy issues as well for
newcomers looking to get involved.

> The only thing I really care about is that adding a new test class and
> making it work with every host language requires the minimum amount of
> changes to the rest of the code. For the C bindings, a VArray with all the
> test classes would be ideal. In my new branch, I moved that code from
> TestEngine to Lucy::Test but I'm not sure if that's the better idea.

We might consider looking to xUnit once again for inspiration and
encapsulating the list of TestBatches within a TestSuite -- but that's
something we could tackle down the road.

Marvin Humphrey

Reply via email to