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 for the "sort" tool. Fixed ...
details: https://anonhg.NetBSD.org/pkgsrc/rev/5c175f2837b2
branches: trunk
changeset: 515137:5c175f2837b2
user: rillig <rillig%pkgsrc.org@localhost>
date: Sun Jun 25 21:47:28 2006 +0000
description:
Added a test for the "sort" tool. Fixed pkglint warnings.
diffstat:
regress/tools/Makefile | 15 +++++++++------
regress/tools/files/sort-test.sh | 38 ++++++++++++++++++++++++++++++++++++++
2 files changed, 47 insertions(+), 6 deletions(-)
diffs (75 lines):
diff -r 5925b4fcc9c6 -r 5c175f2837b2 regress/tools/Makefile
--- a/regress/tools/Makefile Sun Jun 25 19:53:13 2006 +0000
+++ b/regress/tools/Makefile Sun Jun 25 21:47:28 2006 +0000
@@ -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@localhost
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 -r 5925b4fcc9c6 -r 5c175f2837b2 regress/tools/files/sort-test.sh
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/regress/tools/files/sort-test.sh Sun Jun 25 21:47:28 2006 +0000
@@ -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"
Home |
Main Index |
Thread Index |
Old Index