aboutsummaryrefslogtreecommitdiff
path: root/tap/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tap/tests')
-rw-r--r--tap/tests/Makefile.am7
-rw-r--r--tap/tests/README12
-rw-r--r--tap/tests/diag/Makefile.am13
-rw-r--r--tap/tests/diag/test.c46
-rw-r--r--tap/tests/diag/test.pl16
-rw-r--r--tap/tests/diag/test.t29
-rw-r--r--tap/tests/fail/Makefile.am13
-rw-r--r--tap/tests/fail/test.c46
-rw-r--r--tap/tests/fail/test.pl17
-rw-r--r--tap/tests/fail/test.t29
-rw-r--r--tap/tests/ok/Makefile.am3
-rw-r--r--tap/tests/ok/ok-hash/Makefile.am13
-rw-r--r--tap/tests/ok/ok-hash/test.c52
-rw-r--r--tap/tests/ok/ok-hash/test.pl24
-rw-r--r--tap/tests/ok/ok-hash/test.t29
-rw-r--r--tap/tests/ok/ok-numeric/Makefile.am13
-rw-r--r--tap/tests/ok/ok-numeric/test.c49
-rw-r--r--tap/tests/ok/ok-numeric/test.pl21
-rw-r--r--tap/tests/ok/ok-numeric/test.t29
-rw-r--r--tap/tests/ok/ok/Makefile.am13
-rw-r--r--tap/tests/ok/ok/test.c55
-rw-r--r--tap/tests/ok/ok/test.pl27
-rw-r--r--tap/tests/ok/ok/test.t29
-rw-r--r--tap/tests/pass/Makefile.am13
-rw-r--r--tap/tests/pass/test.c46
-rw-r--r--tap/tests/pass/test.pl17
-rw-r--r--tap/tests/pass/test.t29
-rw-r--r--tap/tests/plan/Makefile.am7
-rw-r--r--tap/tests/plan/no-tests/Makefile.am13
-rw-r--r--tap/tests/plan/no-tests/test.c43
-rw-r--r--tap/tests/plan/no-tests/test.pl14
-rw-r--r--tap/tests/plan/no-tests/test.t29
-rw-r--r--tap/tests/plan/no_plan/Makefile.am13
-rw-r--r--tap/tests/plan/no_plan/test.c43
-rw-r--r--tap/tests/plan/no_plan/test.pl14
-rw-r--r--tap/tests/plan/no_plan/test.t29
-rw-r--r--tap/tests/plan/not-enough-tests/Makefile.am13
-rw-r--r--tap/tests/plan/not-enough-tests/test.c49
-rw-r--r--tap/tests/plan/not-enough-tests/test.pl20
-rw-r--r--tap/tests/plan/not-enough-tests/test.t29
-rw-r--r--tap/tests/plan/sane/Makefile.am13
-rw-r--r--tap/tests/plan/sane/test.c43
-rw-r--r--tap/tests/plan/sane/test.pl14
-rw-r--r--tap/tests/plan/sane/test.t29
-rw-r--r--tap/tests/plan/skip_all/Makefile.am13
-rw-r--r--tap/tests/plan/skip_all/test.c38
-rw-r--r--tap/tests/plan/skip_all/test.pl11
-rw-r--r--tap/tests/plan/skip_all/test.t29
-rw-r--r--tap/tests/plan/too-many-plans/Makefile.am13
-rw-r--r--tap/tests/plan/too-many-plans/test.c49
-rw-r--r--tap/tests/plan/too-many-plans/test.pl20
-rw-r--r--tap/tests/plan/too-many-plans/test.t29
-rw-r--r--tap/tests/plan/too-many-tests/Makefile.am13
-rw-r--r--tap/tests/plan/too-many-tests/test.c46
-rw-r--r--tap/tests/plan/too-many-tests/test.pl17
-rw-r--r--tap/tests/plan/too-many-tests/test.t29
-rw-r--r--tap/tests/skip/Makefile.am13
-rw-r--r--tap/tests/skip/test.c69
-rw-r--r--tap/tests/skip/test.pl40
-rw-r--r--tap/tests/skip/test.t29
-rw-r--r--tap/tests/todo/Makefile.am13
-rw-r--r--tap/tests/todo/test.c68
-rw-r--r--tap/tests/todo/test.pl41
-rw-r--r--tap/tests/todo/test.t29
64 files changed, 1714 insertions, 0 deletions
diff --git a/tap/tests/Makefile.am b/tap/tests/Makefile.am
new file mode 100644
index 00000000..481a9672
--- /dev/null
+++ b/tap/tests/Makefile.am
@@ -0,0 +1,7 @@
+SUBDIRS= diag
+SUBDIRS+= fail
+SUBDIRS+= ok
+SUBDIRS+= pass
+SUBDIRS+= plan
+SUBDIRS+= skip
+SUBDIRS+= todo
diff --git a/tap/tests/README b/tap/tests/README
new file mode 100644
index 00000000..a15fec28
--- /dev/null
+++ b/tap/tests/README
@@ -0,0 +1,12 @@
+Most of the tests follow the same pattern.
+
+ * test.pl that uses Test::More, and demonstrates whatever functionality
+ that we're trying to test. This is the reference code.
+
+ * test.c, which tests the libtap reimplementation of the same functionality.
+
+ * test.t, which compiles the .c program, runs both test scripts, and then
+ diffs their output to make sure it's identical.
+
+ Right now, test.t is identical in every directory. This sucks somewhat.
+ It should either be a symlink to a common script
diff --git a/tap/tests/diag/Makefile.am b/tap/tests/diag/Makefile.am
new file mode 100644
index 00000000..c1ccb751
--- /dev/null
+++ b/tap/tests/diag/Makefile.am
@@ -0,0 +1,13 @@
+
+TESTS = test.t
+TESTS_ENVIRONMENT = $(SHELL)
+
+EXTRA_DIST = $(TESTS) test.pl
+
+check_PROGRAMS = test
+
+test_CFLAGS = -g -I../../src
+test_LDFLAGS = -L../../src
+test_LDADD = -ltap
+
+CLEANFILES = test.o test.c.out test.pl.out
diff --git a/tap/tests/diag/test.c b/tap/tests/diag/test.c
new file mode 100644
index 00000000..401db647
--- /dev/null
+++ b/tap/tests/diag/test.c
@@ -0,0 +1,46 @@
+/*-
+ * Copyright (c) 2004 Nik Clayton
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <stdio.h>
+
+#include "tap.h"
+
+int
+main(int argc, char *argv[])
+{
+ unsigned int rc = 0;
+
+ plan_tests(2);
+
+ rc = diag("A diagnostic message");
+ diag("Returned: %d", rc);
+
+ /* Make sure the failure is passed through */
+ ok(1, "test 1") || diag("ok() failed, and shouldn't");
+ ok(0, "test 2") || diag("ok() passed, and shouldn't");
+
+ return exit_status();
+}
diff --git a/tap/tests/diag/test.pl b/tap/tests/diag/test.pl
new file mode 100644
index 00000000..621dc27d
--- /dev/null
+++ b/tap/tests/diag/test.pl
@@ -0,0 +1,16 @@
+#!/usr/bin/perl
+
+use warnings;
+use strict;
+
+use Test::More;
+
+my $rc = 0;
+
+plan tests => 2;
+
+$rc = diag("A diagnostic message");
+diag("Returned: $rc");
+
+ok(1, 'test 1') or diag "ok() failed, and shouldn't";
+ok(0, 'test 2') or diag "ok() passed, and shouldn't";
diff --git a/tap/tests/diag/test.t b/tap/tests/diag/test.t
new file mode 100644
index 00000000..bf0fe8f1
--- /dev/null
+++ b/tap/tests/diag/test.t
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+cd `dirname $0`
+
+echo '1..2'
+
+make 2>&1 > /dev/null
+
+perl ./test.pl 2>&1 | sed -e 's/# Failed test \(.*\)/# Failed test ()/' > test.pl.out
+perlstatus=$?
+
+./test 2>&1 | sed -e 's/# Failed test \(.*\)/# Failed test ()/' > test.c.out
+cstatus=$?
+
+diff -u test.pl.out test.c.out
+
+if [ $? -eq 0 ]; then
+ echo 'ok 1 - output is identical'
+else
+ echo 'not ok 1 - output is identical'
+fi
+
+if [ $perlstatus -eq $cstatus ]; then
+ echo 'ok 2 - status code'
+else
+ echo 'not ok 2 - status code'
+ echo "# perlstatus = $perlstatus"
+ echo "# cstatus = $cstatus"
+fi
diff --git a/tap/tests/fail/Makefile.am b/tap/tests/fail/Makefile.am
new file mode 100644
index 00000000..c1ccb751
--- /dev/null
+++ b/tap/tests/fail/Makefile.am
@@ -0,0 +1,13 @@
+
+TESTS = test.t
+TESTS_ENVIRONMENT = $(SHELL)
+
+EXTRA_DIST = $(TESTS) test.pl
+
+check_PROGRAMS = test
+
+test_CFLAGS = -g -I../../src
+test_LDFLAGS = -L../../src
+test_LDADD = -ltap
+
+CLEANFILES = test.o test.c.out test.pl.out
diff --git a/tap/tests/fail/test.c b/tap/tests/fail/test.c
new file mode 100644
index 00000000..621b6c29
--- /dev/null
+++ b/tap/tests/fail/test.c
@@ -0,0 +1,46 @@
+/*-
+ * Copyright (c) 2004 Nik Clayton
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <stdio.h>
+
+#include "tap.h"
+
+int
+main(int argc, char *argv[])
+{
+ unsigned int rc = 0;
+
+ rc = plan_tests(2);
+ diag("Returned: %d", rc);
+
+ rc = fail("test to fail");
+ diag("Returned: %d", rc);
+
+ rc = fail("test to fail %s", "with extra string");
+ diag("Returned: %d", rc);
+
+ return exit_status();
+}
diff --git a/tap/tests/fail/test.pl b/tap/tests/fail/test.pl
new file mode 100644
index 00000000..73de1a7b
--- /dev/null
+++ b/tap/tests/fail/test.pl
@@ -0,0 +1,17 @@
+#!/usr/bin/perl
+
+use warnings;
+use strict;
+
+use Test::More;
+
+my $rc = 0;
+
+$rc = plan tests => 2;
+diag("Returned: " . sprintf('%d', $rc));
+
+$rc = fail('test to fail');
+diag("Returned: $rc");
+
+$rc = fail('test to fail with extra string');
+diag("Returned: $rc");
diff --git a/tap/tests/fail/test.t b/tap/tests/fail/test.t
new file mode 100644
index 00000000..bf0fe8f1
--- /dev/null
+++ b/tap/tests/fail/test.t
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+cd `dirname $0`
+
+echo '1..2'
+
+make 2>&1 > /dev/null
+
+perl ./test.pl 2>&1 | sed -e 's/# Failed test \(.*\)/# Failed test ()/' > test.pl.out
+perlstatus=$?
+
+./test 2>&1 | sed -e 's/# Failed test \(.*\)/# Failed test ()/' > test.c.out
+cstatus=$?
+
+diff -u test.pl.out test.c.out
+
+if [ $? -eq 0 ]; then
+ echo 'ok 1 - output is identical'
+else
+ echo 'not ok 1 - output is identical'
+fi
+
+if [ $perlstatus -eq $cstatus ]; then
+ echo 'ok 2 - status code'
+else
+ echo 'not ok 2 - status code'
+ echo "# perlstatus = $perlstatus"
+ echo "# cstatus = $cstatus"
+fi
diff --git a/tap/tests/ok/Makefile.am b/tap/tests/ok/Makefile.am
new file mode 100644
index 00000000..c9497480
--- /dev/null
+++ b/tap/tests/ok/Makefile.am
@@ -0,0 +1,3 @@
+SUBDIRS = ok
+SUBDIRS += ok-hash
+SUBDIRS += ok-numeric
diff --git a/tap/tests/ok/ok-hash/Makefile.am b/tap/tests/ok/ok-hash/Makefile.am
new file mode 100644
index 00000000..91d880e7
--- /dev/null
+++ b/tap/tests/ok/ok-hash/Makefile.am
@@ -0,0 +1,13 @@
+
+TESTS = test.t
+TESTS_ENVIRONMENT = $(SHELL)
+
+EXTRA_DIST = $(TESTS) test.pl
+
+check_PROGRAMS = test
+
+test_CFLAGS = -g -I../../../src
+test_LDFLAGS = -L../../../src
+test_LDADD = -ltap
+
+CLEANFILES = test.o test.c.out test.pl.out
diff --git a/tap/tests/ok/ok-hash/test.c b/tap/tests/ok/ok-hash/test.c
new file mode 100644
index 00000000..16be137a
--- /dev/null
+++ b/tap/tests/ok/ok-hash/test.c
@@ -0,0 +1,52 @@
+/*-
+ * Copyright (c) 2004 Nik Clayton
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <stdio.h>
+
+#include "tap.h"
+
+int
+main(int argc, char *argv[])
+{
+ unsigned int rc = 0;
+
+ rc = plan_tests(4);
+ diag("Returned: %d", rc);
+
+ rc = ok(1, "Test with no hash");
+ diag("Returned: %d", rc);
+
+ rc = ok(1, "Test with one # hash");
+ diag("Returned: %d", rc);
+
+ rc = ok(1, "Test with # two # hashes");
+ diag("Returned: %d", rc);
+
+ rc = ok(1, "Test with ## back to back hashes");
+ diag("Returned: %d", rc);
+
+ return exit_status();
+}
diff --git a/tap/tests/ok/ok-hash/test.pl b/tap/tests/ok/ok-hash/test.pl
new file mode 100644
index 00000000..306ddca0
--- /dev/null
+++ b/tap/tests/ok/ok-hash/test.pl
@@ -0,0 +1,24 @@
+#!/usr/bin/perl
+
+use warnings;
+use strict;
+
+use Test::More;
+
+my $rc = 0;
+
+$rc = plan tests => 4;
+diag("Returned: " . sprintf("%d", $rc));
+
+
+$rc = ok(1, 'Test with no hash');
+diag("Returned: $rc");
+
+$rc = ok(1, 'Test with one # hash');
+diag("Returned: $rc");
+
+$rc = ok(1, 'Test with # two # hashes');
+diag("Returned: $rc");
+
+$rc = ok(1, 'Test with ## back to back hashes');
+diag("Returned: $rc");
diff --git a/tap/tests/ok/ok-hash/test.t b/tap/tests/ok/ok-hash/test.t
new file mode 100644
index 00000000..bf0fe8f1
--- /dev/null
+++ b/tap/tests/ok/ok-hash/test.t
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+cd `dirname $0`
+
+echo '1..2'
+
+make 2>&1 > /dev/null
+
+perl ./test.pl 2>&1 | sed -e 's/# Failed test \(.*\)/# Failed test ()/' > test.pl.out
+perlstatus=$?
+
+./test 2>&1 | sed -e 's/# Failed test \(.*\)/# Failed test ()/' > test.c.out
+cstatus=$?
+
+diff -u test.pl.out test.c.out
+
+if [ $? -eq 0 ]; then
+ echo 'ok 1 - output is identical'
+else
+ echo 'not ok 1 - output is identical'
+fi
+
+if [ $perlstatus -eq $cstatus ]; then
+ echo 'ok 2 - status code'
+else
+ echo 'not ok 2 - status code'
+ echo "# perlstatus = $perlstatus"
+ echo "# cstatus = $cstatus"
+fi
diff --git a/tap/tests/ok/ok-numeric/Makefile.am b/tap/tests/ok/ok-numeric/Makefile.am
new file mode 100644
index 00000000..91d880e7
--- /dev/null
+++ b/tap/tests/ok/ok-numeric/Makefile.am
@@ -0,0 +1,13 @@
+
+TESTS = test.t
+TESTS_ENVIRONMENT = $(SHELL)
+
+EXTRA_DIST = $(TESTS) test.pl
+
+check_PROGRAMS = test
+
+test_CFLAGS = -g -I../../../src
+test_LDFLAGS = -L../../../src
+test_LDADD = -ltap
+
+CLEANFILES = test.o test.c.out test.pl.out
diff --git a/tap/tests/ok/ok-numeric/test.c b/tap/tests/ok/ok-numeric/test.c
new file mode 100644
index 00000000..0e33a748
--- /dev/null
+++ b/tap/tests/ok/ok-numeric/test.c
@@ -0,0 +1,49 @@
+/*-
+ * Copyright (c) 2004 Nik Clayton
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <stdio.h>
+
+#include "tap.h"
+
+int
+main(int argc, char *argv[])
+{
+ unsigned int rc = 0;
+
+ rc = plan_tests(3);
+ diag("Returned: %d", rc);
+
+ rc = ok(1, "First test");
+ diag("Returned: %d", rc);
+
+ rc = ok(1, "1");
+ diag("Returned: %d", rc);
+
+ rc = ok(1, "Third test");
+ diag("Returned: %d", rc);
+
+ return exit_status();
+}
diff --git a/tap/tests/ok/ok-numeric/test.pl b/tap/tests/ok/ok-numeric/test.pl
new file mode 100644
index 00000000..86f165f2
--- /dev/null
+++ b/tap/tests/ok/ok-numeric/test.pl
@@ -0,0 +1,21 @@
+#!/usr/bin/perl
+
+use warnings;
+use strict;
+
+use Test::More;
+
+my $rc = 0;
+
+$rc = plan tests => 3;
+diag("Returned: " . sprintf("%d", $rc));
+
+
+$rc = ok(1, 'First test');
+diag("Returned: $rc");
+
+$rc = ok(1, '1');
+diag("Returned: $rc");
+
+$rc = ok(1, 'Third test');
+diag("Returned: $rc");
diff --git a/tap/tests/ok/ok-numeric/test.t b/tap/tests/ok/ok-numeric/test.t
new file mode 100644
index 00000000..bf0fe8f1
--- /dev/null
+++ b/tap/tests/ok/ok-numeric/test.t
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+cd `dirname $0`
+
+echo '1..2'
+
+make 2>&1 > /dev/null
+
+perl ./test.pl 2>&1 | sed -e 's/# Failed test \(.*\)/# Failed test ()/' > test.pl.out
+perlstatus=$?
+
+./test 2>&1 | sed -e 's/# Failed test \(.*\)/# Failed test ()/' > test.c.out
+cstatus=$?
+
+diff -u test.pl.out test.c.out
+
+if [ $? -eq 0 ]; then
+ echo 'ok 1 - output is identical'
+else
+ echo 'not ok 1 - output is identical'
+fi
+
+if [ $perlstatus -eq $cstatus ]; then
+ echo 'ok 2 - status code'
+else
+ echo 'not ok 2 - status code'
+ echo "# perlstatus = $perlstatus"
+ echo "# cstatus = $cstatus"
+fi
diff --git a/tap/tests/ok/ok/Makefile.am b/tap/tests/ok/ok/Makefile.am
new file mode 100644
index 00000000..91d880e7
--- /dev/null
+++ b/tap/tests/ok/ok/Makefile.am
@@ -0,0 +1,13 @@
+
+TESTS = test.t
+TESTS_ENVIRONMENT = $(SHELL)
+
+EXTRA_DIST = $(TESTS) test.pl
+
+check_PROGRAMS = test
+
+test_CFLAGS = -g -I../../../src
+test_LDFLAGS = -L../../../src
+test_LDADD = -ltap
+
+CLEANFILES = test.o test.c.out test.pl.out
diff --git a/tap/tests/ok/ok/test.c b/tap/tests/ok/ok/test.c
new file mode 100644
index 00000000..ae04f2e4
--- /dev/null
+++ b/tap/tests/ok/ok/test.c
@@ -0,0 +1,55 @@
+/*-
+ * Copyright (c) 2004 Nik Clayton
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <stdio.h>
+
+#include "tap.h"
+
+int
+main(int argc, char *argv[])
+{
+ unsigned int rc = 0;
+
+ rc = plan_tests(5);
+ diag("Returned: %d", rc);
+
+ rc = ok(1 == 1, "1 equals 1");
+ diag("Returned: %d", rc);
+
+ rc = ok(1 == 1, "1 equals %d", 1);
+ diag("Returned: %d", rc);
+
+ rc = ok1(1 == 1);
+ diag("Returned: %d", rc);
+
+ rc = ok(1 == 2, "1 equals 2");
+ diag("Returned: %d", rc);
+
+ rc = ok1(1 == 2);
+ diag("Returned: %d", rc);
+
+ return exit_status();
+}
diff --git a/tap/tests/ok/ok/test.pl b/tap/tests/ok/ok/test.pl
new file mode 100644
index 00000000..59f41819
--- /dev/null
+++ b/tap/tests/ok/ok/test.pl
@@ -0,0 +1,27 @@
+#!/usr/bin/perl
+
+use warnings;
+use strict;
+
+use Test::More;
+
+my $rc = 0;
+
+$rc = plan tests => 5;
+diag("Returned: " . sprintf("%d", $rc));
+
+
+$rc = ok(1 == 1, '1 equals 1'); # Test ok() passes when it should
+diag("Returned: $rc");
+
+$rc = ok(1 == 1, '1 equals 1'); # Used for %d testing in test.c
+diag("Returned: $rc");
+
+$rc = ok(1 == 1, '1 == 1'); # Test ok1() passes when it should
+diag("Returned: $rc");
+
+$rc = ok(1 == 2, '1 equals 2'); # Test ok() fails when it should
+diag("Returned: $rc");
+
+$rc = ok(1 == 2, '1 == 2'); # Test ok1() fails when it should
+diag("Returned: $rc");
diff --git a/tap/tests/ok/ok/test.t b/tap/tests/ok/ok/test.t
new file mode 100644
index 00000000..bf0fe8f1
--- /dev/null
+++ b/tap/tests/ok/ok/test.t
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+cd `dirname $0`
+
+echo '1..2'
+
+make 2>&1 > /dev/null
+
+perl ./test.pl 2>&1 | sed -e 's/# Failed test \(.*\)/# Failed test ()/' > test.pl.out
+perlstatus=$?
+
+./test 2>&1 | sed -e 's/# Failed test \(.*\)/# Failed test ()/' > test.c.out
+cstatus=$?
+
+diff -u test.pl.out test.c.out
+
+if [ $? -eq 0 ]; then
+ echo 'ok 1 - output is identical'
+else
+ echo 'not ok 1 - output is identical'
+fi
+
+if [ $perlstatus -eq $cstatus ]; then
+ echo 'ok 2 - status code'
+else
+ echo 'not ok 2 - status code'
+ echo "# perlstatus = $perlstatus"
+ echo "# cstatus = $cstatus"
+fi
diff --git a/tap/tests/pass/Makefile.am b/tap/tests/pass/Makefile.am
new file mode 100644
index 00000000..c1ccb751
--- /dev/null
+++ b/tap/tests/pass/Makefile.am
@@ -0,0 +1,13 @@
+
+TESTS = test.t
+TESTS_ENVIRONMENT = $(SHELL)
+
+EXTRA_DIST = $(TESTS) test.pl
+
+check_PROGRAMS = test
+
+test_CFLAGS = -g -I../../src
+test_LDFLAGS = -L../../src
+test_LDADD = -ltap
+
+CLEANFILES = test.o test.c.out test.pl.out
diff --git a/tap/tests/pass/test.c b/tap/tests/pass/test.c
new file mode 100644
index 00000000..39d8a7c1
--- /dev/null
+++ b/tap/tests/pass/test.c
@@ -0,0 +1,46 @@
+/*-
+ * Copyright (c) 2004 Nik Clayton
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <stdio.h>
+
+#include "tap.h"
+
+int
+main(int argc, char *argv[])
+{
+ unsigned int rc = 0;
+
+ rc = plan_tests(2);
+ diag("Returned: %d", rc);
+
+ rc = pass("test to pass");
+ diag("Returned: %d", rc);
+
+ rc = pass("test to pass %s", "with extra string");
+ diag("Returned: %d", rc);
+
+ return exit_status();
+}
diff --git a/tap/tests/pass/test.pl b/tap/tests/pass/test.pl
new file mode 100644
index 00000000..8abc92e7
--- /dev/null
+++ b/tap/tests/pass/test.pl
@@ -0,0 +1,17 @@
+#!/usr/bin/perl
+
+use warnings;
+use strict;
+
+use Test::More;
+
+my $rc = 0;
+
+$rc = plan tests => 2;
+diag("Returned: " . sprintf('%d', $rc));
+
+$rc = pass('test to pass');
+diag("Returned: $rc");
+
+$rc = pass('test to pass with extra string');
+diag("Returned: $rc");
diff --git a/tap/tests/pass/test.t b/tap/tests/pass/test.t
new file mode 100644
index 00000000..bf0fe8f1
--- /dev/null
+++ b/tap/tests/pass/test.t
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+cd `dirname $0`
+
+echo '1..2'
+
+make 2>&1 > /dev/null
+
+perl ./test.pl 2>&1 | sed -e 's/# Failed test \(.*\)/# Failed test ()/' > test.pl.out
+perlstatus=$?
+
+./test 2>&1 | sed -e 's/# Failed test \(.*\)/# Failed test ()/' > test.c.out
+cstatus=$?
+
+diff -u test.pl.out test.c.out
+
+if [ $? -eq 0 ]; then
+ echo 'ok 1 - output is identical'
+else
+ echo 'not ok 1 - output is identical'
+fi
+
+if [ $perlstatus -eq $cstatus ]; then
+ echo 'ok 2 - status code'
+else
+ echo 'not ok 2 - status code'
+ echo "# perlstatus = $perlstatus"
+ echo "# cstatus = $cstatus"
+fi
diff --git a/tap/tests/plan/Makefile.am b/tap/tests/plan/Makefile.am
new file mode 100644
index 00000000..0724931a
--- /dev/null
+++ b/tap/tests/plan/Makefile.am
@@ -0,0 +1,7 @@
+SUBDIRS = no-tests
+SUBDIRS += no_plan
+SUBDIRS += not-enough-tests
+SUBDIRS += too-many-plans
+SUBDIRS += too-many-tests
+SUBDIRS += sane
+SUBDIRS += skip_all
diff --git a/tap/tests/plan/no-tests/Makefile.am b/tap/tests/plan/no-tests/Makefile.am
new file mode 100644
index 00000000..91d880e7
--- /dev/null
+++ b/tap/tests/plan/no-tests/Makefile.am
@@ -0,0 +1,13 @@
+
+TESTS = test.t
+TESTS_ENVIRONMENT = $(SHELL)
+
+EXTRA_DIST = $(TESTS) test.pl
+
+check_PROGRAMS = test
+
+test_CFLAGS = -g -I../../../src
+test_LDFLAGS = -L../../../src
+test_LDADD = -ltap
+
+CLEANFILES = test.o test.c.out test.pl.out
diff --git a/tap/tests/plan/no-tests/test.c b/tap/tests/plan/no-tests/test.c
new file mode 100644
index 00000000..78c5d371
--- /dev/null
+++ b/tap/tests/plan/no-tests/test.c
@@ -0,0 +1,43 @@
+/*-
+ * Copyright (c) 2004 Nik Clayton
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <stdio.h>
+
+#include "tap.h"
+
+int
+main(int argc, char *argv[])
+{
+ unsigned int rc = 0;
+
+ rc = plan_tests(0);
+ diag("Returned: %d", rc);
+
+ rc = ok(1, NULL);
+ diag("Returned: %d", rc);
+
+ return exit_status();
+}
diff --git a/tap/tests/plan/no-tests/test.pl b/tap/tests/plan/no-tests/test.pl
new file mode 100644
index 00000000..93d2b3b8
--- /dev/null
+++ b/tap/tests/plan/no-tests/test.pl
@@ -0,0 +1,14 @@
+#!/usr/bin/perl
+
+use warnings;
+use strict;
+
+use Test::More;
+
+my $rc = 0;
+
+$rc = plan tests => 0;
+diag("Returned: " . sprintf("%d", $rc));
+
+$rc = ok(1);
+diag("Returned: $rc");
diff --git a/tap/tests/plan/no-tests/test.t b/tap/tests/plan/no-tests/test.t
new file mode 100644
index 00000000..bf0fe8f1
--- /dev/null
+++ b/tap/tests/plan/no-tests/test.t
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+cd `dirname $0`
+
+echo '1..2'
+
+make 2>&1 > /dev/null
+
+perl ./test.pl 2>&1 | sed -e 's/# Failed test \(.*\)/# Failed test ()/' > test.pl.out
+perlstatus=$?
+
+./test 2>&1 | sed -e 's/# Failed test \(.*\)/# Failed test ()/' > test.c.out
+cstatus=$?
+
+diff -u test.pl.out test.c.out
+
+if [ $? -eq 0 ]; then
+ echo 'ok 1 - output is identical'
+else
+ echo 'not ok 1 - output is identical'
+fi
+
+if [ $perlstatus -eq $cstatus ]; then
+ echo 'ok 2 - status code'
+else
+ echo 'not ok 2 - status code'
+ echo "# perlstatus = $perlstatus"
+ echo "# cstatus = $cstatus"
+fi
diff --git a/tap/tests/plan/no_plan/Makefile.am b/tap/tests/plan/no_plan/Makefile.am
new file mode 100644
index 00000000..91d880e7
--- /dev/null
+++ b/tap/tests/plan/no_plan/Makefile.am
@@ -0,0 +1,13 @@
+
+TESTS = test.t
+TESTS_ENVIRONMENT = $(SHELL)
+
+EXTRA_DIST = $(TESTS) test.pl
+
+check_PROGRAMS = test
+
+test_CFLAGS = -g -I../../../src
+test_LDFLAGS = -L../../../src
+test_LDADD = -ltap
+
+CLEANFILES = test.o test.c.out test.pl.out
diff --git a/tap/tests/plan/no_plan/test.c b/tap/tests/plan/no_plan/test.c
new file mode 100644
index 00000000..5cffbdc2
--- /dev/null
+++ b/tap/tests/plan/no_plan/test.c
@@ -0,0 +1,43 @@
+/*-
+ * Copyright (c) 2004 Nik Clayton
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <stdio.h>
+
+#include "tap.h"
+
+int
+main(int argc, char *argv[])
+{
+ unsigned int rc = 0;
+
+ rc = plan_no_plan();
+ diag("Returned: %d", rc);
+
+ rc = ok(1, NULL);
+ diag("Returned: %d", rc);
+
+ return exit_status();
+}
diff --git a/tap/tests/plan/no_plan/test.pl b/tap/tests/plan/no_plan/test.pl
new file mode 100644
index 00000000..19e42b57
--- /dev/null
+++ b/tap/tests/plan/no_plan/test.pl
@@ -0,0 +1,14 @@
+#!/usr/bin/perl
+
+use warnings;
+use strict;
+
+my $rc = 0;
+
+use Test::More;
+
+$rc = plan qw(no_plan);
+diag("Returned: " . sprintf("%d", $rc));
+
+$rc = ok(1);
+diag("Returned: $rc");
diff --git a/tap/tests/plan/no_plan/test.t b/tap/tests/plan/no_plan/test.t
new file mode 100644
index 00000000..bf0fe8f1
--- /dev/null
+++ b/tap/tests/plan/no_plan/test.t
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+cd `dirname $0`
+
+echo '1..2'
+
+make 2>&1 > /dev/null
+
+perl ./test.pl 2>&1 | sed -e 's/# Failed test \(.*\)/# Failed test ()/' > test.pl.out
+perlstatus=$?
+
+./test 2>&1 | sed -e 's/# Failed test \(.*\)/# Failed test ()/' > test.c.out
+cstatus=$?
+
+diff -u test.pl.out test.c.out
+
+if [ $? -eq 0 ]; then
+ echo 'ok 1 - output is identical'
+else
+ echo 'not ok 1 - output is identical'
+fi
+
+if [ $perlstatus -eq $cstatus ]; then
+ echo 'ok 2 - status code'
+else
+ echo 'not ok 2 - status code'
+ echo "# perlstatus = $perlstatus"
+ echo "# cstatus = $cstatus"
+fi
diff --git a/tap/tests/plan/not-enough-tests/Makefile.am b/tap/tests/plan/not-enough-tests/Makefile.am
new file mode 100644
index 00000000..91d880e7
--- /dev/null
+++ b/tap/tests/plan/not-enough-tests/Makefile.am
@@ -0,0 +1,13 @@
+
+TESTS = test.t
+TESTS_ENVIRONMENT = $(SHELL)
+
+EXTRA_DIST = $(TESTS) test.pl
+
+check_PROGRAMS = test
+
+test_CFLAGS = -g -I../../../src
+test_LDFLAGS = -L../../../src
+test_LDADD = -ltap
+
+CLEANFILES = test.o test.c.out test.pl.out
diff --git a/tap/tests/plan/not-enough-tests/test.c b/tap/tests/plan/not-enough-tests/test.c
new file mode 100644
index 00000000..a9ec64f2
--- /dev/null
+++ b/tap/tests/plan/not-enough-tests/test.c
@@ -0,0 +1,49 @@
+/*-
+ * Copyright (c) 2004 Nik Clayton
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <stdio.h>
+
+#include "tap.h"
+
+int
+main(int argc, char *argv[])
+{
+ unsigned int rc = 0;
+
+ rc = plan_tests(1);
+ diag("Returned: %d", rc);
+
+ rc = ok(1, NULL);
+ diag("Returned: %d", rc);
+
+ rc = ok(1, NULL);
+ diag("Returned: %d", rc);
+
+ rc = ok(1, NULL);
+ diag("Returned: %d", rc);
+
+ return exit_status();
+}
diff --git a/tap/tests/plan/not-enough-tests/test.pl b/tap/tests/plan/not-enough-tests/test.pl
new file mode 100644
index 00000000..73787a7c
--- /dev/null
+++ b/tap/tests/plan/not-enough-tests/test.pl
@@ -0,0 +1,20 @@
+#!/usr/bin/perl
+
+use warnings;
+use strict;
+
+use Test::More;
+
+my $rc = 0;
+
+$rc = plan tests => 1;
+diag("Returned: " . sprintf("%d", $rc));
+
+$rc = ok(1);
+diag("Returned: $rc");
+
+$rc = ok(1);
+diag("Returned: $rc");
+
+$rc = ok(1);
+diag("Returned: $rc");
diff --git a/tap/tests/plan/not-enough-tests/test.t b/tap/tests/plan/not-enough-tests/test.t
new file mode 100644
index 00000000..bf0fe8f1
--- /dev/null
+++ b/tap/tests/plan/not-enough-tests/test.t
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+cd `dirname $0`
+
+echo '1..2'
+
+make 2>&1 > /dev/null
+
+perl ./test.pl 2>&1 | sed -e 's/# Failed test \(.*\)/# Failed test ()/' > test.pl.out
+perlstatus=$?
+
+./test 2>&1 | sed -e 's/# Failed test \(.*\)/# Failed test ()/' > test.c.out
+cstatus=$?
+
+diff -u test.pl.out test.c.out
+
+if [ $? -eq 0 ]; then
+ echo 'ok 1 - output is identical'
+else
+ echo 'not ok 1 - output is identical'
+fi
+
+if [ $perlstatus -eq $cstatus ]; then
+ echo 'ok 2 - status code'
+else
+ echo 'not ok 2 - status code'
+ echo "# perlstatus = $perlstatus"
+ echo "# cstatus = $cstatus"
+fi
diff --git a/tap/tests/plan/sane/Makefile.am b/tap/tests/plan/sane/Makefile.am
new file mode 100644
index 00000000..91d880e7
--- /dev/null
+++ b/tap/tests/plan/sane/Makefile.am
@@ -0,0 +1,13 @@
+
+TESTS = test.t
+TESTS_ENVIRONMENT = $(SHELL)
+
+EXTRA_DIST = $(TESTS) test.pl
+
+check_PROGRAMS = test
+
+test_CFLAGS = -g -I../../../src
+test_LDFLAGS = -L../../../src
+test_LDADD = -ltap
+
+CLEANFILES = test.o test.c.out test.pl.out
diff --git a/tap/tests/plan/sane/test.c b/tap/tests/plan/sane/test.c
new file mode 100644
index 00000000..0843d3af
--- /dev/null
+++ b/tap/tests/plan/sane/test.c
@@ -0,0 +1,43 @@
+/*-
+ * Copyright (c) 2004 Nik Clayton
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <stdio.h>
+
+#include "tap.h"
+
+int
+main(int argc, char *argv[])
+{
+ unsigned int rc = 0;
+
+ rc = plan_tests(1);
+ diag("Returned: %d", rc);
+
+ rc = ok(1, NULL);
+ diag("Returned: %d", rc);
+
+ return exit_status();
+}
diff --git a/tap/tests/plan/sane/test.pl b/tap/tests/plan/sane/test.pl
new file mode 100644
index 00000000..35c4ef2f
--- /dev/null
+++ b/tap/tests/plan/sane/test.pl
@@ -0,0 +1,14 @@
+#!/usr/bin/perl
+
+use warnings;
+use strict;
+
+use Test::More;
+
+my $rc = 0;
+
+$rc = plan tests => 1;
+diag("Returned: " . sprintf("%d", $rc));
+
+$rc = ok(1);
+diag("Returned: $rc");
diff --git a/tap/tests/plan/sane/test.t b/tap/tests/plan/sane/test.t
new file mode 100644
index 00000000..bf0fe8f1
--- /dev/null
+++ b/tap/tests/plan/sane/test.t
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+cd `dirname $0`
+
+echo '1..2'
+
+make 2>&1 > /dev/null
+
+perl ./test.pl 2>&1 | sed -e 's/# Failed test \(.*\)/# Failed test ()/' > test.pl.out
+perlstatus=$?
+
+./test 2>&1 | sed -e 's/# Failed test \(.*\)/# Failed test ()/' > test.c.out
+cstatus=$?
+
+diff -u test.pl.out test.c.out
+
+if [ $? -eq 0 ]; then
+ echo 'ok 1 - output is identical'
+else
+ echo 'not ok 1 - output is identical'
+fi
+
+if [ $perlstatus -eq $cstatus ]; then
+ echo 'ok 2 - status code'
+else
+ echo 'not ok 2 - status code'
+ echo "# perlstatus = $perlstatus"
+ echo "# cstatus = $cstatus"
+fi
diff --git a/tap/tests/plan/skip_all/Makefile.am b/tap/tests/plan/skip_all/Makefile.am
new file mode 100644
index 00000000..91d880e7
--- /dev/null
+++ b/tap/tests/plan/skip_all/Makefile.am
@@ -0,0 +1,13 @@
+
+TESTS = test.t
+TESTS_ENVIRONMENT = $(SHELL)
+
+EXTRA_DIST = $(TESTS) test.pl
+
+check_PROGRAMS = test
+
+test_CFLAGS = -g -I../../../src
+test_LDFLAGS = -L../../../src
+test_LDADD = -ltap
+
+CLEANFILES = test.o test.c.out test.pl.out
diff --git a/tap/tests/plan/skip_all/test.c b/tap/tests/plan/skip_all/test.c
new file mode 100644
index 00000000..31722da9
--- /dev/null
+++ b/tap/tests/plan/skip_all/test.c
@@ -0,0 +1,38 @@
+/*-
+ * Copyright (c) 2004 Nik Clayton
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include "tap.h"
+
+int
+main(int argc, char *argv[])
+{
+ unsigned int rc = 0;
+
+ rc = plan_skip_all("No good reason");
+ diag("Returned: %d", rc);
+
+ return exit_status();
+}
diff --git a/tap/tests/plan/skip_all/test.pl b/tap/tests/plan/skip_all/test.pl
new file mode 100644
index 00000000..32555724
--- /dev/null
+++ b/tap/tests/plan/skip_all/test.pl
@@ -0,0 +1,11 @@
+#!/usr/bin/perl
+
+use warnings;
+use strict;
+
+use Test::More;
+
+my $rc = 0;
+
+$rc = plan skip_all => "No good reason";
+diag("Returned: " . sprintf("%d", $rc));
diff --git a/tap/tests/plan/skip_all/test.t b/tap/tests/plan/skip_all/test.t
new file mode 100644
index 00000000..bf0fe8f1
--- /dev/null
+++ b/tap/tests/plan/skip_all/test.t
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+cd `dirname $0`
+
+echo '1..2'
+
+make 2>&1 > /dev/null
+
+perl ./test.pl 2>&1 | sed -e 's/# Failed test \(.*\)/# Failed test ()/' > test.pl.out
+perlstatus=$?
+
+./test 2>&1 | sed -e 's/# Failed test \(.*\)/# Failed test ()/' > test.c.out
+cstatus=$?
+
+diff -u test.pl.out test.c.out
+
+if [ $? -eq 0 ]; then
+ echo 'ok 1 - output is identical'
+else
+ echo 'not ok 1 - output is identical'
+fi
+
+if [ $perlstatus -eq $cstatus ]; then
+ echo 'ok 2 - status code'
+else
+ echo 'not ok 2 - status code'
+ echo "# perlstatus = $perlstatus"
+ echo "# cstatus = $cstatus"
+fi
diff --git a/tap/tests/plan/too-many-plans/Makefile.am b/tap/tests/plan/too-many-plans/Makefile.am
new file mode 100644
index 00000000..91d880e7
--- /dev/null
+++ b/tap/tests/plan/too-many-plans/Makefile.am
@@ -0,0 +1,13 @@
+
+TESTS = test.t
+TESTS_ENVIRONMENT = $(SHELL)
+
+EXTRA_DIST = $(TESTS) test.pl
+
+check_PROGRAMS = test
+
+test_CFLAGS = -g -I../../../src
+test_LDFLAGS = -L../../../src
+test_LDADD = -ltap
+
+CLEANFILES = test.o test.c.out test.pl.out
diff --git a/tap/tests/plan/too-many-plans/test.c b/tap/tests/plan/too-many-plans/test.c
new file mode 100644
index 00000000..b189cb72
--- /dev/null
+++ b/tap/tests/plan/too-many-plans/test.c
@@ -0,0 +1,49 @@
+/*-
+ * Copyright (c) 2004 Nik Clayton
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <stdio.h>
+
+#include "tap.h"
+
+int
+main(int argc, char *argv[])
+{
+ unsigned int rc = 0;
+
+ rc = plan_tests(1);
+ diag("Returned: %d", rc);
+
+ rc = ok(1, NULL);
+ diag("Returned: %d", rc);
+
+ rc = plan_tests(1);
+ diag("Returned: %d", rc);
+
+ rc = ok(0, NULL);
+ diag("Returned: %d", rc);
+
+ return exit_status();
+}
diff --git a/tap/tests/plan/too-many-plans/test.pl b/tap/tests/plan/too-many-plans/test.pl
new file mode 100644
index 00000000..893e5fc0
--- /dev/null
+++ b/tap/tests/plan/too-many-plans/test.pl
@@ -0,0 +1,20 @@
+#!/usr/bin/perl
+
+use warnings;
+use strict;
+
+use Test::More;
+
+my $rc = 0;
+
+$rc = plan tests => 1;
+diag("Returned: " . sprintf("%d", $rc));
+
+$rc = ok(1);
+diag("Returned: $rc");
+
+$rc = plan tests => 1;
+diag("Returned: $rc");
+
+$rc = ok(0);
+diag("Returned: $rc");
diff --git a/tap/tests/plan/too-many-plans/test.t b/tap/tests/plan/too-many-plans/test.t
new file mode 100644
index 00000000..cd2acf74
--- /dev/null
+++ b/tap/tests/plan/too-many-plans/test.t
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+cd `dirname $0`
+
+echo '1..2'
+
+make 2>&1 > /dev/null
+
+perl ./test.pl 2>&1 | sed -e 's/twice!.*$/twice!/' > test.pl.out
+perlstatus=$?
+
+./test 2>&1 | sed -e 's/twice!.*$/twice!/' > test.c.out
+cstatus=$?
+
+diff -u test.pl.out test.c.out
+
+if [ $? -eq 0 ]; then
+ echo 'ok 1 - output is identical'
+else
+ echo 'not ok 1 - output is identical'
+fi
+
+if [ $perlstatus -eq $cstatus ]; then
+ echo 'ok 2 - status code'
+else
+ echo 'not ok 2 - status code'
+ echo "# perlstatus = $perlstatus"
+ echo "# cstatus = $cstatus"
+fi
diff --git a/tap/tests/plan/too-many-tests/Makefile.am b/tap/tests/plan/too-many-tests/Makefile.am
new file mode 100644
index 00000000..91d880e7
--- /dev/null
+++ b/tap/tests/plan/too-many-tests/Makefile.am
@@ -0,0 +1,13 @@
+
+TESTS = test.t
+TESTS_ENVIRONMENT = $(SHELL)
+
+EXTRA_DIST = $(TESTS) test.pl
+
+check_PROGRAMS = test
+
+test_CFLAGS = -g -I../../../src
+test_LDFLAGS = -L../../../src
+test_LDADD = -ltap
+
+CLEANFILES = test.o test.c.out test.pl.out
diff --git a/tap/tests/plan/too-many-tests/test.c b/tap/tests/plan/too-many-tests/test.c
new file mode 100644
index 00000000..0f724104
--- /dev/null
+++ b/tap/tests/plan/too-many-tests/test.c
@@ -0,0 +1,46 @@
+/*-
+ * Copyright (c) 2004 Nik Clayton
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <stdio.h>
+
+#include "tap.h"
+
+int
+main(int argc, char *argv[])
+{
+ unsigned int rc = 0;
+
+ rc = plan_tests(5);
+ diag("Returned: %d", rc);
+
+ rc = ok(1, NULL);
+ diag("Returned: %d", rc);
+
+ rc = ok(0, NULL);
+ diag("Returned: %d", rc);
+
+ return exit_status();
+}
diff --git a/tap/tests/plan/too-many-tests/test.pl b/tap/tests/plan/too-many-tests/test.pl
new file mode 100644
index 00000000..0a1666ba
--- /dev/null
+++ b/tap/tests/plan/too-many-tests/test.pl
@@ -0,0 +1,17 @@
+#!/usr/bin/perl
+
+use warnings;
+use strict;
+
+use Test::More;
+
+my $rc = 0;
+
+$rc = plan tests => 5;
+diag("Returned: " . sprintf("%d", $rc));
+
+$rc = ok(1);
+diag("Returned: $rc");
+
+$rc = ok(0);
+diag("Returned: $rc");
diff --git a/tap/tests/plan/too-many-tests/test.t b/tap/tests/plan/too-many-tests/test.t
new file mode 100644
index 00000000..bf0fe8f1
--- /dev/null
+++ b/tap/tests/plan/too-many-tests/test.t
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+cd `dirname $0`
+
+echo '1..2'
+
+make 2>&1 > /dev/null
+
+perl ./test.pl 2>&1 | sed -e 's/# Failed test \(.*\)/# Failed test ()/' > test.pl.out
+perlstatus=$?
+
+./test 2>&1 | sed -e 's/# Failed test \(.*\)/# Failed test ()/' > test.c.out
+cstatus=$?
+
+diff -u test.pl.out test.c.out
+
+if [ $? -eq 0 ]; then
+ echo 'ok 1 - output is identical'
+else
+ echo 'not ok 1 - output is identical'
+fi
+
+if [ $perlstatus -eq $cstatus ]; then
+ echo 'ok 2 - status code'
+else
+ echo 'not ok 2 - status code'
+ echo "# perlstatus = $perlstatus"
+ echo "# cstatus = $cstatus"
+fi
diff --git a/tap/tests/skip/Makefile.am b/tap/tests/skip/Makefile.am
new file mode 100644
index 00000000..c1ccb751
--- /dev/null
+++ b/tap/tests/skip/Makefile.am
@@ -0,0 +1,13 @@
+
+TESTS = test.t
+TESTS_ENVIRONMENT = $(SHELL)
+
+EXTRA_DIST = $(TESTS) test.pl
+
+check_PROGRAMS = test
+
+test_CFLAGS = -g -I../../src
+test_LDFLAGS = -L../../src
+test_LDADD = -ltap
+
+CLEANFILES = test.o test.c.out test.pl.out
diff --git a/tap/tests/skip/test.c b/tap/tests/skip/test.c
new file mode 100644
index 00000000..d8f3eafd
--- /dev/null
+++ b/tap/tests/skip/test.c
@@ -0,0 +1,69 @@
+/*-
+ * Copyright (c) 2004 Nik Clayton
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <stdio.h>
+
+#include "tap.h"
+
+int
+main(int argc, char *argv[])
+{
+ unsigned int rc = 0;
+ unsigned int side_effect = 0;
+
+ rc = plan_tests(4);
+ diag("Returned: %d", rc);
+
+ rc = ok(1 == 1, "1 equals 1"); /* Should always work */
+ diag("Returned: %d", rc);
+
+ do {
+ if(1) {
+ rc = skip(1, "Testing skipping");
+ continue;
+ }
+
+ side_effect++;
+
+ ok(side_effect == 1, "side_effect checked out");
+
+ } while(0);
+
+ diag("Returned: %d", rc);
+
+ skip_start(1 == 1, 1, "Testing skipping #2");
+
+ side_effect++;
+ rc = ok(side_effect == 1, "side_effect checked out");
+ diag("Returned: %d", rc);
+
+ skip_end;
+
+ rc = ok(side_effect == 0, "side_effect is %d", side_effect);
+ diag("Returned: %d", rc);
+
+ return exit_status();
+}
diff --git a/tap/tests/skip/test.pl b/tap/tests/skip/test.pl
new file mode 100644
index 00000000..dc294717
--- /dev/null
+++ b/tap/tests/skip/test.pl
@@ -0,0 +1,40 @@
+#!/usr/bin/perl
+
+use warnings;
+use strict;
+
+use Test::More;
+
+my $rc = 0;
+
+$rc = plan tests => 4;
+diag("Returned: " . sprintf("%d", $rc));
+
+my $side_effect = 0; # Check whether skipping has side effects
+
+$rc = ok(1 == 1, '1 equals 1'); # Test ok() passes when it should
+diag("Returned: $rc");
+
+# Start skipping
+SKIP: {
+ $rc = skip "Testing skipping", 1;
+
+ $side_effect++;
+
+ $rc = ok($side_effect == 1, '$side_effect checked out');
+}
+
+diag("Returned: $rc");
+
+SKIP: {
+ $rc = skip "Testing skipping #2", 1;
+ diag("Returned: $rc");
+
+ $side_effect++;
+
+ $rc = ok($side_effect == 1, '$side_effect checked out');
+ diag("Returned: $rc");
+}
+
+$rc = ok($side_effect == 0, "side_effect is $side_effect");
+diag("Returned: $rc");
diff --git a/tap/tests/skip/test.t b/tap/tests/skip/test.t
new file mode 100644
index 00000000..bf0fe8f1
--- /dev/null
+++ b/tap/tests/skip/test.t
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+cd `dirname $0`
+
+echo '1..2'
+
+make 2>&1 > /dev/null
+
+perl ./test.pl 2>&1 | sed -e 's/# Failed test \(.*\)/# Failed test ()/' > test.pl.out
+perlstatus=$?
+
+./test 2>&1 | sed -e 's/# Failed test \(.*\)/# Failed test ()/' > test.c.out
+cstatus=$?
+
+diff -u test.pl.out test.c.out
+
+if [ $? -eq 0 ]; then
+ echo 'ok 1 - output is identical'
+else
+ echo 'not ok 1 - output is identical'
+fi
+
+if [ $perlstatus -eq $cstatus ]; then
+ echo 'ok 2 - status code'
+else
+ echo 'not ok 2 - status code'
+ echo "# perlstatus = $perlstatus"
+ echo "# cstatus = $cstatus"
+fi
diff --git a/tap/tests/todo/Makefile.am b/tap/tests/todo/Makefile.am
new file mode 100644
index 00000000..c1ccb751
--- /dev/null
+++ b/tap/tests/todo/Makefile.am
@@ -0,0 +1,13 @@
+
+TESTS = test.t
+TESTS_ENVIRONMENT = $(SHELL)
+
+EXTRA_DIST = $(TESTS) test.pl
+
+check_PROGRAMS = test
+
+test_CFLAGS = -g -I../../src
+test_LDFLAGS = -L../../src
+test_LDADD = -ltap
+
+CLEANFILES = test.o test.c.out test.pl.out
diff --git a/tap/tests/todo/test.c b/tap/tests/todo/test.c
new file mode 100644
index 00000000..ac6339a7
--- /dev/null
+++ b/tap/tests/todo/test.c
@@ -0,0 +1,68 @@
+/*-
+ * Copyright (c) 2004 Nik Clayton
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <stdio.h>
+
+#include "tap.h"
+
+int
+main(int argc, char *argv[])
+{
+ unsigned int rc = 0;
+ unsigned int side_effect = 0;
+
+ rc = plan_tests(5);
+ diag("Returned: %d", rc);
+
+ rc = ok(1 == 1, "1 equals 1"); /* Should always work */
+ diag("Returned: %d", rc);
+
+ todo_start("For testing purposes");
+
+ side_effect++;
+
+ /* This test should fail */
+ rc = ok(side_effect == 0, "side_effect checked out");
+ diag("Returned: %d", rc);
+
+ /* This test should unexpectedly succeed */
+ rc = ok(side_effect == 1, "side_effect checked out");
+ diag("Returned: %d", rc);
+
+ todo_end();
+
+ todo_start("Testing printf() %s in todo_start()", "expansion");
+
+ rc = ok(0, "dummy test");
+ diag("Returned: %d", rc);
+
+ todo_end();
+
+ rc = ok(side_effect == 1, "side_effect is %d", side_effect);
+ diag("Returned: %d", rc);
+
+ return exit_status();
+}
diff --git a/tap/tests/todo/test.pl b/tap/tests/todo/test.pl
new file mode 100644
index 00000000..2621e12f
--- /dev/null
+++ b/tap/tests/todo/test.pl
@@ -0,0 +1,41 @@
+#!/usr/bin/perl
+
+use warnings;
+use strict;
+
+use Test::More;
+
+my $rc = 0;
+
+$rc = plan tests => 5;
+diag("Returned: " . sprintf("%d", $rc));
+
+my $side_effect = 0; # Check whether TODO has side effects
+
+$rc = ok(1 == 1, '1 equals 1'); # Test ok() passes when it should
+diag("Returned: $rc");
+
+# Start TODO tests
+TODO: {
+ local $TODO = 'For testing purposes';
+
+ $side_effect++;
+
+ # This test should fail
+ $rc = ok($side_effect == 0, 'side_effect checked out');
+ diag("Returned: $rc");
+
+ # This test should unexpectedly succeed
+ $rc = ok($side_effect == 1, 'side_effect checked out');
+ diag("Returned: $rc");
+}
+
+TODO: {
+ local $TODO = 'Testing printf() expansion in todo_start()';
+
+ $rc = ok(0, 'dummy test');
+ diag("Returned: $rc");
+}
+
+$rc = ok($side_effect == 1, "side_effect is $side_effect");
+diag("Returned: $rc");
diff --git a/tap/tests/todo/test.t b/tap/tests/todo/test.t
new file mode 100644
index 00000000..7dbb17b6
--- /dev/null
+++ b/tap/tests/todo/test.t
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+cd `dirname $0`
+
+echo '1..2'
+
+make 2>&1 > /dev/null
+
+perl ./test.pl 2>&1 | sed -e 's/# Failed (TODO) test \(.*\)/# Failed (TODO) test ()/' > test.pl.out
+perlstatus=$?
+
+./test 2>&1 | sed -e 's/# Failed (TODO) test \(.*\)/# Failed (TODO) test ()/' > test.c.out
+cstatus=$?
+
+diff -u test.pl.out test.c.out
+
+if [ $? -eq 0 ]; then
+ echo 'ok 1 - output is identical'
+else
+ echo 'not ok 1 - output is identical'
+fi
+
+if [ $perlstatus -eq $cstatus ]; then
+ echo 'ok 2 - status code'
+else
+ echo 'not ok 2 - status code'
+ echo "# perlstatus = $perlstatus"
+ echo "# cstatus = $cstatus"
+fi