From 2bbf2e6967daa0a9f86874aac409fde245a3bc85 Mon Sep 17 00:00:00 2001 From: Thomas Guyot-Sionnest Date: Fri, 28 Nov 2008 05:01:53 -0500 Subject: Add Libtap as a bundled library (does not change any behaviour without --enable-libtap) Detects system library as pre-1.4.13 and does not install the built-in library anymore Tested on: - Linux x86_64, with and without local libtap (System libtap installed) - Linux x86, with and without local libtap (System libtap NOT installed) - Solaris SPARC, with and without local libtap, with and without system libtap installed --- tap/tests/plan/Makefile.am | 7 +++++ tap/tests/plan/no-tests/Makefile.am | 13 ++++++++ tap/tests/plan/no-tests/test.c | 43 +++++++++++++++++++++++++ tap/tests/plan/no-tests/test.pl | 14 +++++++++ tap/tests/plan/no-tests/test.t | 29 +++++++++++++++++ tap/tests/plan/no_plan/Makefile.am | 13 ++++++++ tap/tests/plan/no_plan/test.c | 43 +++++++++++++++++++++++++ tap/tests/plan/no_plan/test.pl | 14 +++++++++ tap/tests/plan/no_plan/test.t | 29 +++++++++++++++++ tap/tests/plan/not-enough-tests/Makefile.am | 13 ++++++++ tap/tests/plan/not-enough-tests/test.c | 49 +++++++++++++++++++++++++++++ tap/tests/plan/not-enough-tests/test.pl | 20 ++++++++++++ tap/tests/plan/not-enough-tests/test.t | 29 +++++++++++++++++ tap/tests/plan/sane/Makefile.am | 13 ++++++++ tap/tests/plan/sane/test.c | 43 +++++++++++++++++++++++++ tap/tests/plan/sane/test.pl | 14 +++++++++ tap/tests/plan/sane/test.t | 29 +++++++++++++++++ tap/tests/plan/skip_all/Makefile.am | 13 ++++++++ tap/tests/plan/skip_all/test.c | 38 ++++++++++++++++++++++ tap/tests/plan/skip_all/test.pl | 11 +++++++ tap/tests/plan/skip_all/test.t | 29 +++++++++++++++++ tap/tests/plan/too-many-plans/Makefile.am | 13 ++++++++ tap/tests/plan/too-many-plans/test.c | 49 +++++++++++++++++++++++++++++ tap/tests/plan/too-many-plans/test.pl | 20 ++++++++++++ tap/tests/plan/too-many-plans/test.t | 29 +++++++++++++++++ tap/tests/plan/too-many-tests/Makefile.am | 13 ++++++++ tap/tests/plan/too-many-tests/test.c | 46 +++++++++++++++++++++++++++ tap/tests/plan/too-many-tests/test.pl | 17 ++++++++++ tap/tests/plan/too-many-tests/test.t | 29 +++++++++++++++++ 29 files changed, 722 insertions(+) create mode 100644 tap/tests/plan/Makefile.am create mode 100644 tap/tests/plan/no-tests/Makefile.am create mode 100644 tap/tests/plan/no-tests/test.c create mode 100644 tap/tests/plan/no-tests/test.pl create mode 100644 tap/tests/plan/no-tests/test.t create mode 100644 tap/tests/plan/no_plan/Makefile.am create mode 100644 tap/tests/plan/no_plan/test.c create mode 100644 tap/tests/plan/no_plan/test.pl create mode 100644 tap/tests/plan/no_plan/test.t create mode 100644 tap/tests/plan/not-enough-tests/Makefile.am create mode 100644 tap/tests/plan/not-enough-tests/test.c create mode 100644 tap/tests/plan/not-enough-tests/test.pl create mode 100644 tap/tests/plan/not-enough-tests/test.t create mode 100644 tap/tests/plan/sane/Makefile.am create mode 100644 tap/tests/plan/sane/test.c create mode 100644 tap/tests/plan/sane/test.pl create mode 100644 tap/tests/plan/sane/test.t create mode 100644 tap/tests/plan/skip_all/Makefile.am create mode 100644 tap/tests/plan/skip_all/test.c create mode 100644 tap/tests/plan/skip_all/test.pl create mode 100644 tap/tests/plan/skip_all/test.t create mode 100644 tap/tests/plan/too-many-plans/Makefile.am create mode 100644 tap/tests/plan/too-many-plans/test.c create mode 100644 tap/tests/plan/too-many-plans/test.pl create mode 100644 tap/tests/plan/too-many-plans/test.t create mode 100644 tap/tests/plan/too-many-tests/Makefile.am create mode 100644 tap/tests/plan/too-many-tests/test.c create mode 100644 tap/tests/plan/too-many-tests/test.pl create mode 100644 tap/tests/plan/too-many-tests/test.t (limited to 'tap/tests/plan') 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 + +#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 + +#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 + +#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 + +#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 + +#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 + +#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 -- cgit v1.2.3-74-g34f1