summaryrefslogtreecommitdiff
path: root/regress
diff options
context:
space:
mode:
authorrillig <rillig@pkgsrc.org>2006-06-25 21:47:28 +0000
committerrillig <rillig@pkgsrc.org>2006-06-25 21:47:28 +0000
commitaa0acb70fa5dd9f14adc396976ff88e79eacca9d (patch)
tree006ee0136bebdcfc6cc4cc8afab71e69192dfd6e /regress
parent2905139798d0de2d8c6c39253cc29b89bcbaaf77 (diff)
downloadpkgsrc-aa0acb70fa5dd9f14adc396976ff88e79eacca9d.tar.gz
Added a test for the "sort" tool. Fixed pkglint warnings.
Diffstat (limited to 'regress')
-rw-r--r--regress/tools/Makefile15
-rw-r--r--regress/tools/files/sort-test.sh38
2 files changed, 47 insertions, 6 deletions
diff --git a/regress/tools/Makefile b/regress/tools/Makefile
index f926d7428b5..310144d1e5f 100644
--- a/regress/tools/Makefile
+++ b/regress/tools/Makefile
@@ -1,20 +1,23 @@
-# $NetBSD: Makefile,v 1.3 2005/11/24 19:39:23 rillig Exp $
+# $NetBSD: Makefile,v 1.4 2006/06/25 21:47:28 rillig Exp $
#
-DISTNAME= regress-tools-1.0
+DISTNAME= # not applicable
+PKGNAME= regress-tools-1.1
CATEGORIES= regress
-DISTFILES= # empty
+MASTER_SITES= # none
+DISTFILES= # none
MAINTAINER= rillig@NetBSD.org
COMMENT= Test whether the TOOLS do what I expect
+NO_CHECKSUM= yes
WRKSRC= ${WRKDIR}
-REGRESS_TESTS= awk tr
-USE_TOOLS+= awk tr
+REGRESS_TESTS= awk sort tr
+USE_TOOLS+= awk sort tr
do-build:
.for t in ${REGRESS_TESTS}
- @${_PKG_SILENT}${_PKG_DEBUG}set -e; cd ${WRKSRC:Q}; \
+ ${_PKG_SILENT}${_PKG_DEBUG}set -e; cd ${WRKSRC:Q}; \
${ECHO_MSG} "Running testsuite "${t:Q}; \
${SH} ${FILESDIR:Q}/${t:Q}-test.sh
.endfor
diff --git a/regress/tools/files/sort-test.sh b/regress/tools/files/sort-test.sh
new file mode 100644
index 00000000000..f1bae3a5181
--- /dev/null
+++ b/regress/tools/files/sort-test.sh
@@ -0,0 +1,38 @@
+#! /bin/sh
+# $NetBSD: sort-test.sh,v 1.1 2006/06/25 21:47:28 rillig Exp $
+#
+
+set -e
+
+mydir=`dirname "$0"`
+. "${mydir}/tests.subr"
+
+#
+# Functions specific for the "sort" testsuite.
+#
+
+# usage: sort_test <testname> <input> <expected-output> <args...>
+sort_test() {
+ testname=$1; input=$2; expected=$3; shift 3;
+
+ testcase_start "${testname}"
+ output=`sort "$@" <<EOF
+$input
+EOF
+`
+ assert_equal "${testname}" "${expected}" "${output}"
+}
+
+#
+# The actual test.
+#
+
+nl="
+"
+
+sort_test "one line" \
+ "text line 1" "text line 1"
+sort_test "uppercase letters" \
+ "A${nl}B${nl}C" "A${nl}B${nl}C"
+sort_test "A < C < b" \
+ "A${nl}b${nl}C" "A${nl}C${nl}b"