summaryrefslogtreecommitdiff
path: root/regress
diff options
context:
space:
mode:
authorrillig <rillig>2006-11-09 12:39:55 +0000
committerrillig <rillig>2006-11-09 12:39:55 +0000
commitedc37a2f74acc51491296d7aeb1cdeff143f648d (patch)
treed78ee45d2b9f519f9e86be8d4e4fa901d029eac3 /regress
parent7cc34a3abb92e5d38d42c5c71a8de34105534f13 (diff)
downloadpkgsrc-edc37a2f74acc51491296d7aeb1cdeff143f648d.tar.gz
Added a test new case for /bin/sh.
Diffstat (limited to 'regress')
-rw-r--r--regress/tools/Makefile8
-rw-r--r--regress/tools/files/sh-test.sh41
2 files changed, 45 insertions, 4 deletions
diff --git a/regress/tools/Makefile b/regress/tools/Makefile
index 211cb998255..890de8dc290 100644
--- a/regress/tools/Makefile
+++ b/regress/tools/Makefile
@@ -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 @@ COMMENT= Test whether the TOOLS do what I expect
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 --git a/regress/tools/files/sh-test.sh b/regress/tools/files/sh-test.sh
new file mode 100644
index 00000000000..d3dab9d9a51
--- /dev/null
+++ b/regress/tools/files/sh-test.sh
@@ -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%%/\**}"