Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src Regression tests for awk(1) (PR 44063)



details:   https://anonhg.NetBSD.org/src/rev/829319873eb2
branches:  trunk
changeset: 771480:829319873eb2
user:      cheusov <cheusov%NetBSD.org@localhost>
date:      Tue Nov 22 20:22:09 2011 +0000

description:
Regression tests for awk(1) (PR 44063)

diffstat:

 distrib/sets/lists/tests/mi    |   5 ++++-
 tests/util/awk/Makefile        |   5 ++++-
 tests/util/awk/d_assign_NF.awk |  16 ++++++++++++++++
 tests/util/awk/d_assign_NF.in  |   1 +
 tests/util/awk/d_assign_NF.out |   9 +++++++++
 tests/util/awk/t_awk.sh        |  13 ++++++++++++-
 6 files changed, 46 insertions(+), 3 deletions(-)

diffs (107 lines):

diff -r 2c9439730461 -r 829319873eb2 distrib/sets/lists/tests/mi
--- a/distrib/sets/lists/tests/mi       Tue Nov 22 19:33:38 2011 +0000
+++ b/distrib/sets/lists/tests/mi       Tue Nov 22 20:22:09 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.425 2011/11/21 23:50:44 joerg Exp $
+# $NetBSD: mi,v 1.426 2011/11/22 20:22:09 cheusov Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -2713,6 +2713,9 @@
 ./usr/tests/util/Atffile                       tests-util-tests
 ./usr/tests/util/awk                           tests-util-tests
 ./usr/tests/util/awk/Atffile                   tests-util-tests
+./usr/tests/util/awk/d_assign_NF.awk           tests-util-tests
+./usr/tests/util/awk/d_assign_NF.in            tests-util-tests
+./usr/tests/util/awk/d_assign_NF.out           tests-util-tests
 ./usr/tests/util/awk/d_big_regexp.awk          tests-util-tests
 ./usr/tests/util/awk/d_big_regexp.in           tests-util-tests
 ./usr/tests/util/awk/d_big_regexp.out          tests-util-tests
diff -r 2c9439730461 -r 829319873eb2 tests/util/awk/Makefile
--- a/tests/util/awk/Makefile   Tue Nov 22 19:33:38 2011 +0000
+++ b/tests/util/awk/Makefile   Tue Nov 22 20:22:09 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.2 2011/04/30 11:24:14 alnsn Exp $
+# $NetBSD: Makefile,v 1.3 2011/11/22 20:22:10 cheusov Exp $
 
 NOMAN=         # defined
 
@@ -29,5 +29,8 @@
 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>
diff -r 2c9439730461 -r 829319873eb2 tests/util/awk/d_assign_NF.awk
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/util/awk/d_assign_NF.awk    Tue Nov 22 20:22:09 2011 +0000
@@ -0,0 +1,16 @@
+# $NetBSD: d_assign_NF.awk,v 1.1 2011/11/22 20:22:10 cheusov 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 2c9439730461 -r 829319873eb2 tests/util/awk/d_assign_NF.in
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/util/awk/d_assign_NF.in     Tue Nov 22 20:22:09 2011 +0000
@@ -0,0 +1,1 @@
+ 1    2  3
diff -r 2c9439730461 -r 829319873eb2 tests/util/awk/d_assign_NF.out
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/util/awk/d_assign_NF.out    Tue Nov 22 20:22:09 2011 +0000
@@ -0,0 +1,9 @@
+$0=`1 2`
+$3=``
+$4=``
+$0=`1 2 `
+$3=``
+$4=``
+$0=`1 2  `
+$3=``
+$4=``
diff -r 2c9439730461 -r 829319873eb2 tests/util/awk/t_awk.sh
--- a/tests/util/awk/t_awk.sh   Tue Nov 22 19:33:38 2011 +0000
+++ b/tests/util/awk/t_awk.sh   Tue Nov 22 20:22:09 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: t_awk.sh,v 1.6 2011/05/02 08:30:21 jruoho Exp $
+# $NetBSD: t_awk.sh,v 1.7 2011/11/22 20:22:10 cheusov Exp $
 #
 # Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -98,6 +98,16 @@
        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
+}
+
 atf_init_test_cases()
 {
        atf_add_test_case big_regexp
@@ -105,4 +115,5 @@
        atf_add_test_case string1
        atf_add_test_case multibyte
        atf_add_test_case period
+       atf_add_test_case assign_NF
 }



Home | Main Index | Thread Index | Old Index