Re: C implementation of Test::Harness' TAP protocol

2004-12-06 Thread Michael G Schwern
On Tue, Dec 07, 2004 at 03:18:17PM +1100, Andrew Savige wrote: > Good idea Schwern. > These test suites inevitably degenerate into macro crack-pipe > smoking sessions. Lacking 'eval', it is always going to be very > hard work to even get close to Perl's Test::More functionality > and ease-of-use in

Test labels

2004-12-06 Thread Andy Lester
I think even better than ok( $expr, "name" ); or ok( $expr, "comment" ); is ok( $expr, "label" ); RJBS points out that "comment" implies "not really worth doing", and I still don't like "name" because it implies (to me) a unique identifier. We also talked about "description", but "desc

Re: C implementation of Test::Harness' TAP protocol

2004-12-06 Thread Andrew Savige
--- Michael G Schwern <[EMAIL PROTECTED]> wrote: > Yucko. > > Test::More implements cmp_ok() using an eval. Could a macro prove useful > here to do something similar? > > cmp_ok(foo, 'int', '==', bar); Good idea Schwern. These test suites inevitably degenerate into macro crack-pipe smoking ses

Re: C implementation of Test::Harness' TAP protocol

2004-12-06 Thread Michael G Schwern
On Tue, Dec 07, 2004 at 12:55:01PM +1100, Andrew Savige wrote: > 3) Implementing cmp_ok() in C is a challenge. ;-) > > xUnit/cutest have things like: > > AssertStrEquals > AssertIntEquals > ... > > The trouble with plain old ok() is that investigating test failures > is a pest. I suppose you cou

Re: C implementation of Test::Harness' TAP protocol

2004-12-06 Thread Andrew Savige
--- "Clayton, Nik" <[EMAIL PROTECTED]> wrote: > Having done the initial work to get most of FreeBSD's regression testing > infrastructure producing Test::Harness TAP compatible output, I've started > putting together a C library that makes it easier to write tests in C. Great! This is something I

Re: C implementation of Test::Harness' TAP protocol

2004-12-06 Thread Andrew Savige
--- Michael G Schwern <[EMAIL PROTECTED]> wrote: > On Mon, Dec 06, 2004 at 02:25:42PM -0800, Andrew Savige wrote: > > --- Michael G Schwern <[EMAIL PROTECTED]> wrote: > > > Why add that extra auto-sprintf complexity? Can't the user do the exact > > > same thing with: > > > > > > ok(some_func(i

Re: C implementation of Test::Harness' TAP protocol

2004-12-06 Thread Michael G Schwern
On Mon, Dec 06, 2004 at 02:25:42PM -0800, Andrew Savige wrote: > --- Michael G Schwern <[EMAIL PROTECTED]> wrote: > > Why add that extra auto-sprintf complexity? Can't the user do the exact > > same thing with: > > > > ok(some_func(i), sprintf("some_func(%d)", i)); > > No. sprintf in C needs

Re: C implementation of Test::Harness' TAP protocol

2004-12-06 Thread Andrew Savige
--- Michael G Schwern <[EMAIL PROTECTED]> wrote: > Why add that extra auto-sprintf complexity? Can't the user do the exact > same thing with: > > ok(some_func(i), sprintf("some_func(%d)", i)); No. sprintf in C needs a buffer and you don't know how big to make it. > > ok2() is for situatio

Re: C implementation of Test::Harness' TAP protocol

2004-12-06 Thread Michael G Schwern
Keeping in mind I'm not a C programmer so my user expectations may be all wrong. On Mon, Dec 06, 2004 at 10:00:32AM -, Clayton, Nik wrote: > Then you have one of ok() or ok2() at your disposal. ok()'s first parameter > is the code to test. The second parameter is the test name. This is a

C implementation of Test::Harness' TAP protocol

2004-12-06 Thread Clayton, Nik
Having done the initial work to get most of FreeBSD's regression testing infrastructure producing Test::Harness TAP compatible output, I've started putting together a C library that makes it easier to write tests in C. This is a few hours work at the moment, but it's functional, and I'd appreciate