pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/regress/tools Added a test new case for /bin/sh.



details:   https://anonhg.NetBSD.org/pkgsrc/rev/f02a048dfcb9
branches:  trunk
changeset: 521324:f02a048dfcb9
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Thu Nov 09 12:39:55 2006 +0000

description:
Added a test new case for /bin/sh.

diffstat:

 regress/tools/Makefile         |   8 ++++----
 regress/tools/files/sh-test.sh |  41 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 45 insertions(+), 4 deletions(-)

diffs (70 lines):

diff -r 9a678c902ca0 -r f02a048dfcb9 regress/tools/Makefile
--- a/regress/tools/Makefile    Thu Nov 09 11:12:06 2006 +0000
+++ b/regress/tools/Makefile    Thu Nov 09 12:39:55 2006 +0000
@@ -1,8 +1,8 @@
-# $NetBSD: Makefile,v 1.5 2006/09/20 07:39:54 rillig Exp $
+# $NetBSD: Makefile,v 1.6 2006/11/09 12:39:55 rillig Exp $
 #
 
 DISTNAME=      # not applicable
-PKGNAME=       regress-tools-1.1
+PKGNAME=       regress-tools-1.2
 CATEGORIES=    regress
 MASTER_SITES=  # none
 DISTFILES=     # none
@@ -12,8 +12,8 @@
 
 NO_CHECKSUM=   yes
 WRKSRC=                ${WRKDIR}
-REGRESS_TESTS= awk sed sort tr
-USE_TOOLS+=    awk sed sort tr
+REGRESS_TESTS= awk sed sh sort tr
+USE_TOOLS+=    awk sed sh sort tr
 
 do-build:
 .for t in ${REGRESS_TESTS}
diff -r 9a678c902ca0 -r f02a048dfcb9 regress/tools/files/sh-test.sh
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/regress/tools/files/sh-test.sh    Thu Nov 09 12:39:55 2006 +0000
@@ -0,0 +1,41 @@
+#! /bin/sh
+# $NetBSD: sh-test.sh,v 1.1 2006/11/09 12:39:55 rillig Exp $
+#
+
+set -e
+
+mydir=`dirname "$0"`
+. "${mydir}/tests.subr"
+
+#
+# Functions specific for the sh testsuite.
+#
+
+# usage: sh_test <testname> <input> <expected-output> <args...>
+sh_test() {
+       testname=$1; input=$2; expected=$3; shift 3;
+
+       testcase_start "${testname}"
+       output=`sh ${1+"$@"} <<EOF
+$input
+EOF
+`
+       assert_equal "${testname}" "${expected}" "${output}"
+}
+
+# usage: sh_assert_equals "testname" "expected" "got"
+sh_assert_equals() {
+
+       testcase_start "$1"
+       assert_equal "$1" "$2" "$3"
+}
+
+#
+# The actual test.
+#
+
+nl="
+"
+
+line="#define bindir \"/usr/bin\" /* bar */"
+sh_assert_equals "removing C comments" "#define bindir \"/usr/bin\" " "${line%%/\**}"



Home | Main Index | Thread Index | Old Index