Oops. I had put the awk-specific functions into test.subr. Moved back.
This commit is contained in:
parent
cfadbbe5f6
commit
dc73dcb087
2 changed files with 27 additions and 19 deletions
|
@ -1,5 +1,5 @@
|
|||
#! /bin/sh
|
||||
# $NetBSD: awk-test.sh,v 1.6 2005/11/24 19:18:45 rillig Exp $
|
||||
# $NetBSD: awk-test.sh,v 1.7 2005/11/24 19:20:18 rillig Exp $
|
||||
#
|
||||
|
||||
set -e
|
||||
|
@ -7,6 +7,31 @@ set -e
|
|||
mydir=`dirname "$0"`
|
||||
. "${mydir}/tests.subr"
|
||||
|
||||
#
|
||||
# Functions specific for the awk testsuite.
|
||||
#
|
||||
|
||||
# usage: test_assignment <testname> <input> <expected-output>
|
||||
test_assignment() {
|
||||
testcase_start "$1"
|
||||
o=`echo "" | awk '{print var}' var="$2"`
|
||||
assert_equal "$1" "$3" "${o}"
|
||||
}
|
||||
|
||||
# usage: test_passline <testname> <input>
|
||||
test_passline() {
|
||||
testcase_start "$1"
|
||||
o=`awk '{print}' <<EOF
|
||||
$2
|
||||
EOF
|
||||
`
|
||||
assert_equal "$1" "$2" "${o}"
|
||||
}
|
||||
|
||||
#
|
||||
# The actual test.
|
||||
#
|
||||
|
||||
#
|
||||
# Assignment of variables from the command line. The Solaris
|
||||
# /usr/bin/awk does not conform to the POSIX specification, but passes
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: tests.subr,v 1.1 2005/11/24 19:18:45 rillig Exp $
|
||||
# $NetBSD: tests.subr,v 1.2 2005/11/24 19:20:18 rillig Exp $
|
||||
#
|
||||
|
||||
# usage: testcase_start <testname>
|
||||
|
@ -14,20 +14,3 @@ assert_equal() {
|
|||
return 1;;
|
||||
esac
|
||||
}
|
||||
|
||||
# usage: test_assignment <testname> <input> <expected-output>
|
||||
test_assignment() {
|
||||
testcase_start "$1"
|
||||
o=`echo "" | awk '{print var}' var="$2"`
|
||||
assert_equal "$1" "$3" "${o}"
|
||||
}
|
||||
|
||||
# usage: test_passline <testname> <input>
|
||||
test_passline() {
|
||||
testcase_start "$1"
|
||||
o=`awk '{print}' <<EOF
|
||||
$2
|
||||
EOF
|
||||
`
|
||||
assert_equal "$1" "$2" "${o}"
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue