Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tests/usr.bin/awk Move the existing tests from util/awk to u...
details: https://anonhg.NetBSD.org/src/rev/53054cdab474
branches: trunk
changeset: 777987:53054cdab474
user: jruoho <jruoho%NetBSD.org@localhost>
date: Sun Mar 11 18:35:59 2012 +0000
description:
Move the existing tests from util/awk to usr.bin/awk.
diffstat:
tests/usr.bin/awk/Makefile | 31 +++++++++++-
tests/usr.bin/awk/d_assign_NF.awk | 16 ++++++
tests/usr.bin/awk/d_assign_NF.in | 1 +
tests/usr.bin/awk/d_assign_NF.out | 9 +++
tests/usr.bin/awk/d_big_regexp.awk | 3 +
tests/usr.bin/awk/d_big_regexp.in | 1 +
tests/usr.bin/awk/d_big_regexp.out | 1 +
tests/usr.bin/awk/d_end1.awk | 5 ++
tests/usr.bin/awk/d_end1.in | 1 +
tests/usr.bin/awk/d_end1.out | 1 +
tests/usr.bin/awk/d_end2.awk | 5 ++
tests/usr.bin/awk/d_end2.in | 1 +
tests/usr.bin/awk/d_end2.out | 1 +
tests/usr.bin/awk/d_period.awk | 1 +
tests/usr.bin/awk/d_period.in | 1 +
tests/usr.bin/awk/d_period.out | 1 +
tests/usr.bin/awk/d_string1.awk | 7 ++
tests/usr.bin/awk/d_string1.out | 2 +
tests/usr.bin/awk/d_tolower.awk | 5 ++
tests/usr.bin/awk/d_tolower.in | 1 +
tests/usr.bin/awk/d_tolower.out | 1 +
tests/usr.bin/awk/d_toupper.awk | 5 ++
tests/usr.bin/awk/d_toupper.in | 1 +
tests/usr.bin/awk/d_toupper.out | 1 +
tests/usr.bin/awk/t_awk.sh | 93 +++++++++++++++++++++++++++++++++++++-
25 files changed, 191 insertions(+), 4 deletions(-)
diffs (truncated from 319 to 300 lines):
diff -r 458e16e50c4d -r 53054cdab474 tests/usr.bin/awk/Makefile
--- a/tests/usr.bin/awk/Makefile Sun Mar 11 18:27:59 2012 +0000
+++ b/tests/usr.bin/awk/Makefile Sun Mar 11 18:35:59 2012 +0000
@@ -1,9 +1,34 @@
-# $NetBSD: Makefile,v 1.1 2012/03/10 19:08:56 christos Exp $
+# $NetBSD: Makefile,v 1.2 2012/03/11 18:35:59 jruoho Exp $
.include <bsd.own.mk>
TESTSDIR= ${TESTSBASE}/usr.bin/awk
+TESTS_SH= t_awk
+NOMAN= # defined
-TESTS_SH= t_awk
+FILESDIR= ${TESTSDIR}
+FILES= d_big_regexp.awk
+FILES+= d_big_regexp.in
+FILES+= d_big_regexp.out
+FILES+= d_end1.awk
+FILES+= d_end1.in
+FILES+= d_end1.out
+FILES+= d_end2.awk
+FILES+= d_end2.in
+FILES+= d_end2.out
+FILES+= d_period.awk
+FILES+= d_period.in
+FILES+= d_period.out
+FILES+= d_string1.awk
+FILES+= d_string1.out
+FILES+= d_tolower.awk
+FILES+= d_tolower.in
+FILES+= d_tolower.out
+FILES+= d_toupper.awk
+FILES+= d_toupper.in
+FILES+= d_toupper.out
+FILES+= d_assign_NF.awk
+FILES+= d_assign_NF.in
+FILES+= d_assign_NF.out
-.include <bsd.test.mk>
+.include <bsd.test.mk>
\ No newline at end of file
diff -r 458e16e50c4d -r 53054cdab474 tests/usr.bin/awk/d_assign_NF.awk
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/usr.bin/awk/d_assign_NF.awk Sun Mar 11 18:35:59 2012 +0000
@@ -0,0 +1,16 @@
+# $NetBSD: d_assign_NF.awk,v 1.1 2012/03/11 18:35:59 jruoho Exp $
+
+{
+ NF = 2
+ print "$0=`" $0 "`"
+ print "$3=`" $3 "`"
+ print "$4=`" $4 "`"
+ NF = 3
+ print "$0=`" $0 "`"
+ print "$3=`" $3 "`"
+ print "$4=`" $4 "`"
+ NF = 4
+ print "$0=`" $0 "`"
+ print "$3=`" $3 "`"
+ print "$4=`" $4 "`"
+}
diff -r 458e16e50c4d -r 53054cdab474 tests/usr.bin/awk/d_assign_NF.in
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/usr.bin/awk/d_assign_NF.in Sun Mar 11 18:35:59 2012 +0000
@@ -0,0 +1,1 @@
+ 1 2 3
diff -r 458e16e50c4d -r 53054cdab474 tests/usr.bin/awk/d_assign_NF.out
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/usr.bin/awk/d_assign_NF.out Sun Mar 11 18:35:59 2012 +0000
@@ -0,0 +1,9 @@
+$0=`1 2`
+$3=``
+$4=``
+$0=`1 2 `
+$3=``
+$4=``
+$0=`1 2 `
+$3=``
+$4=``
diff -r 458e16e50c4d -r 53054cdab474 tests/usr.bin/awk/d_big_regexp.awk
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/usr.bin/awk/d_big_regexp.awk Sun Mar 11 18:35:59 2012 +0000
@@ -0,0 +1,3 @@
+# $NetBSD: d_big_regexp.awk,v 1.1 2012/03/11 18:36:00 jruoho Exp $
+
+/^[^_][^ ]*_NNIFO([ ]+[^_]+[^ ]*_(CC|INR|JJFO|JJMA|JJPG|NNIFG|NNIFO|NNIMPG|NNIMR|NNING|PP3FD|PQINO|PQMO|PSFR|RQ|TC|VIIR3|VPIPN|VPLIPF|NOTAG|RQR))*$/
diff -r 458e16e50c4d -r 53054cdab474 tests/usr.bin/awk/d_big_regexp.in
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/usr.bin/awk/d_big_regexp.in Sun Mar 11 18:35:59 2012 +0000
@@ -0,0 +1,1 @@
+1_NNIFO 1_PSFR 1_JJFO 1_NNIFO 1_INR 1_NNIMR 1_CC 1_NNING 1_RQ 1_VPLIPF 1_NNIFG 1_JJPG 1_NNIMPG 1_PQINO 1_VPIPN 1_PP3FD 1_JJMA 1_PQMO 1_TC 1_VIIR3
diff -r 458e16e50c4d -r 53054cdab474 tests/usr.bin/awk/d_big_regexp.out
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/usr.bin/awk/d_big_regexp.out Sun Mar 11 18:35:59 2012 +0000
@@ -0,0 +1,1 @@
+1_NNIFO 1_PSFR 1_JJFO 1_NNIFO 1_INR 1_NNIMR 1_CC 1_NNING 1_RQ 1_VPLIPF 1_NNIFG 1_JJPG 1_NNIMPG 1_PQINO 1_VPIPN 1_PP3FD 1_JJMA 1_PQMO 1_TC 1_VIIR3
diff -r 458e16e50c4d -r 53054cdab474 tests/usr.bin/awk/d_end1.awk
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/usr.bin/awk/d_end1.awk Sun Mar 11 18:35:59 2012 +0000
@@ -0,0 +1,5 @@
+# $NetBSD: d_end1.awk,v 1.1 2012/03/11 18:36:00 jruoho Exp $
+
+END {
+ print NF;
+}
diff -r 458e16e50c4d -r 53054cdab474 tests/usr.bin/awk/d_end1.in
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/usr.bin/awk/d_end1.in Sun Mar 11 18:35:59 2012 +0000
@@ -0,0 +1,1 @@
+a b c d
diff -r 458e16e50c4d -r 53054cdab474 tests/usr.bin/awk/d_end1.out
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/usr.bin/awk/d_end1.out Sun Mar 11 18:35:59 2012 +0000
@@ -0,0 +1,1 @@
+4
diff -r 458e16e50c4d -r 53054cdab474 tests/usr.bin/awk/d_end2.awk
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/usr.bin/awk/d_end2.awk Sun Mar 11 18:35:59 2012 +0000
@@ -0,0 +1,5 @@
+# $NetBSD: d_end2.awk,v 1.1 2012/03/11 18:36:00 jruoho Exp $
+
+END {
+ print $0;
+}
diff -r 458e16e50c4d -r 53054cdab474 tests/usr.bin/awk/d_end2.in
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/usr.bin/awk/d_end2.in Sun Mar 11 18:35:59 2012 +0000
@@ -0,0 +1,1 @@
+a b c d
diff -r 458e16e50c4d -r 53054cdab474 tests/usr.bin/awk/d_end2.out
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/usr.bin/awk/d_end2.out Sun Mar 11 18:35:59 2012 +0000
@@ -0,0 +1,1 @@
+a b c d
diff -r 458e16e50c4d -r 53054cdab474 tests/usr.bin/awk/d_period.awk
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/usr.bin/awk/d_period.awk Sun Mar 11 18:35:59 2012 +0000
@@ -0,0 +1,1 @@
+{print x + $1 + 0.125}
diff -r 458e16e50c4d -r 53054cdab474 tests/usr.bin/awk/d_period.in
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/usr.bin/awk/d_period.in Sun Mar 11 18:35:59 2012 +0000
@@ -0,0 +1,1 @@
+0,25
diff -r 458e16e50c4d -r 53054cdab474 tests/usr.bin/awk/d_period.out
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/usr.bin/awk/d_period.out Sun Mar 11 18:35:59 2012 +0000
@@ -0,0 +1,1 @@
+0,875
diff -r 458e16e50c4d -r 53054cdab474 tests/usr.bin/awk/d_string1.awk
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/usr.bin/awk/d_string1.awk Sun Mar 11 18:35:59 2012 +0000
@@ -0,0 +1,7 @@
+# $NetBSD: d_string1.awk,v 1.1 2012/03/11 18:36:00 jruoho Exp $
+
+BEGIN {
+ print "A\
+B";
+ print "CD"
+}
diff -r 458e16e50c4d -r 53054cdab474 tests/usr.bin/awk/d_string1.out
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/usr.bin/awk/d_string1.out Sun Mar 11 18:35:59 2012 +0000
@@ -0,0 +1,2 @@
+AB
+CD
diff -r 458e16e50c4d -r 53054cdab474 tests/usr.bin/awk/d_tolower.awk
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/usr.bin/awk/d_tolower.awk Sun Mar 11 18:35:59 2012 +0000
@@ -0,0 +1,5 @@
+# $NetBSD: d_tolower.awk,v 1.1 2012/03/11 18:36:00 jruoho Exp $
+
+END {
+ print tolower($0);
+}
diff -r 458e16e50c4d -r 53054cdab474 tests/usr.bin/awk/d_tolower.in
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/usr.bin/awk/d_tolower.in Sun Mar 11 18:35:59 2012 +0000
@@ -0,0 +1,1 @@
+ABCÃ?Ã?Ã?
diff -r 458e16e50c4d -r 53054cdab474 tests/usr.bin/awk/d_tolower.out
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/usr.bin/awk/d_tolower.out Sun Mar 11 18:35:59 2012 +0000
@@ -0,0 +1,1 @@
+abcæøå
diff -r 458e16e50c4d -r 53054cdab474 tests/usr.bin/awk/d_toupper.awk
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/usr.bin/awk/d_toupper.awk Sun Mar 11 18:35:59 2012 +0000
@@ -0,0 +1,5 @@
+# $NetBSD: d_toupper.awk,v 1.1 2012/03/11 18:36:01 jruoho Exp $
+
+END {
+ print toupper($0);
+}
diff -r 458e16e50c4d -r 53054cdab474 tests/usr.bin/awk/d_toupper.in
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/usr.bin/awk/d_toupper.in Sun Mar 11 18:35:59 2012 +0000
@@ -0,0 +1,1 @@
+abcæøå
diff -r 458e16e50c4d -r 53054cdab474 tests/usr.bin/awk/d_toupper.out
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/usr.bin/awk/d_toupper.out Sun Mar 11 18:35:59 2012 +0000
@@ -0,0 +1,1 @@
+ABCÃ?Ã?Ã?
diff -r 458e16e50c4d -r 53054cdab474 tests/usr.bin/awk/t_awk.sh
--- a/tests/usr.bin/awk/t_awk.sh Sun Mar 11 18:27:59 2012 +0000
+++ b/tests/usr.bin/awk/t_awk.sh Sun Mar 11 18:35:59 2012 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: t_awk.sh,v 1.2 2012/03/10 19:19:24 christos Exp $
+# $NetBSD: t_awk.sh,v 1.3 2012/03/11 18:36:01 jruoho Exp $
#
# Copyright (c) 2012 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -30,6 +30,89 @@
awk=awk
+h_check()
+{
+ local fname=d_$1
+ for sfx in in out awk; do
+ cp -r $(atf_get_srcdir)/$fname.$sfx .
+ done
+ shift 1
+ atf_check -o file:$fname.out -x "awk $@ -f $fname.awk < $fname.in"
+}
+
+atf_test_case big_regexp
+
+big_regexp_head() {
+ atf_set "descr" "Checks matching long regular expressions (PR/33392)"
+}
+
+big_regexp_body() {
+ h_check big_regexp
+}
+
+atf_test_case end
+
+end_head() {
+ atf_set "descr" "Checks that the last line of the input" \
+ "is available under END pattern (PR/29659)"
+}
+
+end_body() {
+ h_check end1
+ h_check end2
+}
+
+atf_test_case string1
+
+string1_head() {
+ atf_set "descr" "Checks escaping newlines in string literals"
+}
+
+string1_body() {
+ for sfx in out awk; do
+ cp -r $(atf_get_srcdir)/d_string1.$sfx .
+ done
+ atf_check -o file:d_string1.out awk -f d_string1.awk
+}
+
+atf_test_case multibyte
+
+multibyte_head() {
+ atf_set "descr" "Checks multibyte charsets support" \
+ "in tolower and toupper (PR/36394)"
+}
+
+multibyte_body() {
+ export LANG=en_US.UTF-8
+
+ h_check tolower
+ h_check toupper
+}
+
+atf_test_case period
+
+period_head() {
+ atf_set "descr" "Checks that the period character is recognised" \
+ "in awk program regardless of locale (bin/42320)"
+}
+
+period_body() {
+ export LANG=ru_RU.KOI8-R
+
+ atf_expect_fail "PR bin/42320"
+ h_check period -v x=0.5
+}
+
+atf_test_case assign_NF
+
+assign_NF_head() {
+ atf_set "descr" 'Checks that assign to NF changes $0 and $n (PR/44063)'
+}
+
+assign_NF_body() {
+ h_check assign_NF
+}
Home |
Main Index |
Thread Index |
Old Index