NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: standards/44063 (awk: setting NF doesn't change $i)
The following reply was made to PR standards/44063; it has been noted by GNATS.
From: Aleksey Cheusov <cheusov%tut.by@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc:
Subject: Re: standards/44063 (awk: setting NF doesn't change $i)
Date: Sat, 19 Nov 2011 22:22:51 +0300
I'd like to commit the following regression test and close this PR.
I think it answers all answered questions.
Objections?
Index: distrib/sets/lists/tests/mi
===================================================================
RCS file: /cvsroot/src/distrib/sets/lists/tests/mi,v
retrieving revision 1.424
diff -u -r1.424 mi
--- distrib/sets/lists/tests/mi 17 Nov 2011 01:22:30 -0000 1.424
+++ distrib/sets/lists/tests/mi 19 Nov 2011 16:38:20 -0000
@@ -2701,6 +2701,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
Index: tests/util/awk/Makefile
===================================================================
RCS file: /cvsroot/src/tests/util/awk/Makefile,v
retrieving revision 1.2
diff -u -r1.2 Makefile
--- tests/util/awk/Makefile 30 Apr 2011 11:24:14 -0000 1.2
+++ tests/util/awk/Makefile 19 Nov 2011 16:38:20 -0000
@@ -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>
Index: tests/util/awk/d_assign_NF.awk
===================================================================
RCS file: tests/util/awk/d_assign_NF.awk
diff -N tests/util/awk/d_assign_NF.awk
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/util/awk/d_assign_NF.awk 19 Nov 2011 16:38:20 -0000
@@ -0,0 +1,16 @@
+# $NetBSD$
+
+{
+ 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 "`"
+}
Index: tests/util/awk/d_assign_NF.in
===================================================================
RCS file: tests/util/awk/d_assign_NF.in
diff -N tests/util/awk/d_assign_NF.in
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/util/awk/d_assign_NF.in 19 Nov 2011 16:38:20 -0000
@@ -0,0 +1 @@
+ 1 2 3
Index: tests/util/awk/d_assign_NF.out
===================================================================
RCS file: tests/util/awk/d_assign_NF.out
diff -N tests/util/awk/d_assign_NF.out
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/util/awk/d_assign_NF.out 19 Nov 2011 16:38:20 -0000
@@ -0,0 +1,9 @@
+$0=`1 2`
+$3=``
+$4=``
+$0=`1 2 `
+$3=``
+$4=``
+$0=`1 2 `
+$3=``
+$4=``
Index: tests/util/awk/t_awk.sh
===================================================================
RCS file: /cvsroot/src/tests/util/awk/t_awk.sh,v
retrieving revision 1.6
diff -u -r1.6 t_awk.sh
--- tests/util/awk/t_awk.sh 2 May 2011 08:30:21 -0000 1.6
+++ tests/util/awk/t_awk.sh 19 Nov 2011 16:38:23 -0000
@@ -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
}
--
Best regards, Aleksey Cheusov.
Home |
Main Index |
Thread Index |
Old Index