[Nagiosplug-devel] Preparation for release 1.4.11
Andreas Ericsson
ae at op5.se
Wed Dec 12 14:38:42 CET 2007
Ton Voon wrote:
> On 11 Dec 2007, at 21:12, Andreas Ericsson wrote:
>
>> In short though, it works like this:
>>
>> --%<---%<---%<---
>> . test-lib.sh
>> test_description 'A simple test for sed'
>>
>> test_expect_success 'Test single char substitution' \
>> '
>> var=$(echo foo | sed s/f//)
>> test "$var" = "oo"
>> '
>>
>> test_done
>> ---%<---%<---%<---
>>
>> Which would produce the following output
>>
>> * ok 1: Test single char substitution
>> * passed all 1 test(s)
>>
>> with the last line printed in green when all tests pass, and in red
>> when any of them fail.
>
>
> You just described something exceedingly similar to perl's Test
> Anything Protocol (http://en.wikipedia.org/wiki/Test_Anything_Protocol
> and http://search.cpan.org/dist/TAP-1.00/TAP.pm).
>
It's similar, but not identical. Its output could be made identical
pretty easy, but for git's purposes the current design is quite
alright and a bit more pleasant than the machine-parsable strict
TAP-standard.
>
> I can see a place for running shell commands instead of via perl
> (which is only just invoking executables anyway), but which shell do
> you program against? Assuming sh is going to be too restrictive. In
> fact, perl was designed to be a cross platform shell! So it makes
> sense to stick with that.
>
> If you think a tutorial is required for understanding the plugins'
> test system, then say that - I can see there is probably a hole in
> this regard: http://nagiosplugins.org/node/12.
>
It's more along the lines of "I as a programmer have absolutely no
idea of how to add a test". I could do some research, but it's not
entirely clear where, or what to look for (I'm a lazy bastard, like
everyone else, and started by looking at an existing test). Since
I saw Thomas talking about the test-suite on the list, I offered a
quick view into the simplest and best-designed testing library for
small-ish command-line programs I've seen.
--
Andreas Ericsson andreas.ericsson at op5.se
OP5 AB www.op5.se
Tel: +46 8-230225 Fax: +46 8-230231
More information about the Devel
mailing list