CVS commit: src/tests/usr.bin/awk

2019-01-18 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jan 19 01:02:12 UTC 2019

Modified Files:
src/tests/usr.bin/awk: t_awk.sh

Log Message:
add a range and a repeat regex test.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/usr.bin/awk/t_awk.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/usr.bin/awk/t_awk.sh
diff -u src/tests/usr.bin/awk/t_awk.sh:1.5 src/tests/usr.bin/awk/t_awk.sh:1.6
--- src/tests/usr.bin/awk/t_awk.sh:1.5	Mon Dec 10 15:30:06 2012
+++ src/tests/usr.bin/awk/t_awk.sh	Fri Jan 18 20:02:12 2019
@@ -1,4 +1,4 @@
-# $NetBSD: t_awk.sh,v 1.5 2012/12/10 20:30:06 christos Exp $
+# $NetBSD: t_awk.sh,v 1.6 2019/01/19 01:02:12 christos Exp $
 #
 # Copyright (c) 2012 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -335,6 +335,30 @@ newline_rs_body() {
 		-x "printf '\n\n\nr1f1\nr1f2\n\nr2f1\nr2f2\n\n\n' | $awk '{\$1=\$1}1' RS= OFS=:"
 }
 
+atf_test_case regex_range
+
+regex_range_head() {
+	atf_set "descr" "Test awk(1) with regex range"
+}
+
+regex_range_body() {
+	atf_check \
+		-o "inline:matched\n" \
+		-x "echo '1 a' | $awk '/[[:digit:]][[:space:]][[:alpha:]]/ { print \"matched\"; }'"
+}
+
+atf_test_case regex_repeat
+
+regex_repeat_head() {
+	atf_set "descr" "Test awk(1) with regex repeat"
+}
+
+regex_repeat_body() {
+	atf_check \
+		-o "inline:matched\n" \
+		-x "echo 'aaacc' | $awk '/a{3}b{4}c{2}/ { print \"matched\"; }'"
+}
+
 atf_test_case modify_subsep
 
 modify_subsep_head() {
@@ -374,5 +398,7 @@ atf_init_test_cases() {
 	atf_add_test_case regex_reallocation_rs
 	atf_add_test_case empty_rs
 	atf_add_test_case newline_rs
+	atf_add_test_case regex_range
+	atf_add_test_case regex_repeat
 	atf_add_test_case modify_subsep
 }



CVS commit: src/tests/usr.bin/awk

2012-12-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Dec 10 20:30:06 UTC 2012

Modified Files:
src/tests/usr.bin/awk: t_awk.sh

Log Message:
add a test case for PR/47306


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/awk/t_awk.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/usr.bin/awk/t_awk.sh
diff -u src/tests/usr.bin/awk/t_awk.sh:1.4 src/tests/usr.bin/awk/t_awk.sh:1.5
--- src/tests/usr.bin/awk/t_awk.sh:1.4	Sat Mar 17 19:22:59 2012
+++ src/tests/usr.bin/awk/t_awk.sh	Mon Dec 10 15:30:06 2012
@@ -1,4 +1,4 @@
-# $NetBSD: t_awk.sh,v 1.4 2012/03/17 23:22:59 christos Exp $
+# $NetBSD: t_awk.sh,v 1.5 2012/12/10 20:30:06 christos Exp $
 #
 # Copyright (c) 2012 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -335,6 +335,19 @@ newline_rs_body() {
 		-x printf '\n\n\nr1f1\nr1f2\n\nr2f1\nr2f2\n\n\n' | $awk '{\$1=\$1}1' RS= OFS=:
 }
 
+atf_test_case modify_subsep
+
+modify_subsep_head() {
+	atf_set descr Test awk(1) SUPSEP modification (PR/47306)
+}
+
+modify_subsep_body() {
+	atf_check \
+		-o inline:1\n1\n1\n \
+		-x printf '1\n1 2\n' | \
+		$awk '1{ arr[\$1 SUBSEP \$2 SUBSEP ++cnt[\$1]]=1} {for (f in arr) print arr[f];}'
+}
+
 atf_init_test_cases() {
 
 	atf_add_test_case big_regexp
@@ -361,4 +374,5 @@ atf_init_test_cases() {
 	atf_add_test_case regex_reallocation_rs
 	atf_add_test_case empty_rs
 	atf_add_test_case newline_rs
+	atf_add_test_case modify_subsep
 }



CVS commit: src/tests/usr.bin/awk

2012-03-19 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Mon Mar 19 13:07:23 UTC 2012

Modified Files:
src/tests/usr.bin/awk: d_period.out

Log Message:
As noted by christos@ in rev. 1.4 to t_awk.sh, the period test has been
broken all along. Fix expected output (tested on Linux, GNU awk 1.3.3).


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/awk/d_period.out

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/usr.bin/awk/d_period.out
diff -u src/tests/usr.bin/awk/d_period.out:1.2 src/tests/usr.bin/awk/d_period.out:1.3
--- src/tests/usr.bin/awk/d_period.out:1.2	Sat Mar 17 23:22:59 2012
+++ src/tests/usr.bin/awk/d_period.out	Mon Mar 19 13:07:23 2012
@@ -1 +1 @@
-0.875
+0.625



CVS commit: src/tests/usr.bin/awk

2012-03-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Mar 17 23:23:00 UTC 2012

Modified Files:
src/tests/usr.bin/awk: d_period.out t_awk.sh

Log Message:
The problem has been fixed and the test is broken. awk always uses the
C locale for LC_NUMERIC.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/awk/d_period.out
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/awk/t_awk.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/usr.bin/awk/d_period.out
diff -u src/tests/usr.bin/awk/d_period.out:1.1 src/tests/usr.bin/awk/d_period.out:1.2
--- src/tests/usr.bin/awk/d_period.out:1.1	Sun Mar 11 14:36:00 2012
+++ src/tests/usr.bin/awk/d_period.out	Sat Mar 17 19:22:59 2012
@@ -1 +1 @@
-0,875
+0.875

Index: src/tests/usr.bin/awk/t_awk.sh
diff -u src/tests/usr.bin/awk/t_awk.sh:1.3 src/tests/usr.bin/awk/t_awk.sh:1.4
--- src/tests/usr.bin/awk/t_awk.sh:1.3	Sun Mar 11 14:36:01 2012
+++ src/tests/usr.bin/awk/t_awk.sh	Sat Mar 17 19:22:59 2012
@@ -1,4 +1,4 @@
-# $NetBSD: t_awk.sh,v 1.3 2012/03/11 18:36:01 jruoho Exp $
+# $NetBSD: t_awk.sh,v 1.4 2012/03/17 23:22:59 christos Exp $
 #
 # Copyright (c) 2012 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -99,7 +99,6 @@ period_head() {
 period_body() {
 	export LANG=ru_RU.KOI8-R
 
-	atf_expect_fail PR bin/42320
 	h_check period -v x=0.5
 }
 



CVS commit: src/tests/usr.bin/awk

2012-03-11 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Sun Mar 11 18:36:01 UTC 2012

Modified Files:
src/tests/usr.bin/awk: Makefile t_awk.sh
Added Files:
src/tests/usr.bin/awk: d_assign_NF.awk d_assign_NF.in d_assign_NF.out
d_big_regexp.awk d_big_regexp.in d_big_regexp.out d_end1.awk
d_end1.in d_end1.out d_end2.awk d_end2.in d_end2.out d_period.awk
d_period.in d_period.out d_string1.awk d_string1.out d_tolower.awk
d_tolower.in d_tolower.out d_toupper.awk d_toupper.in d_toupper.out

Log Message:
Move the existing tests from util/awk to usr.bin/awk.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/awk/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/awk/d_assign_NF.awk \
src/tests/usr.bin/awk/d_assign_NF.in \
src/tests/usr.bin/awk/d_assign_NF.out \
src/tests/usr.bin/awk/d_big_regexp.awk \
src/tests/usr.bin/awk/d_big_regexp.in \
src/tests/usr.bin/awk/d_big_regexp.out src/tests/usr.bin/awk/d_end1.awk \
src/tests/usr.bin/awk/d_end1.in src/tests/usr.bin/awk/d_end1.out \
src/tests/usr.bin/awk/d_end2.awk src/tests/usr.bin/awk/d_end2.in \
src/tests/usr.bin/awk/d_end2.out src/tests/usr.bin/awk/d_period.awk \
src/tests/usr.bin/awk/d_period.in src/tests/usr.bin/awk/d_period.out \
src/tests/usr.bin/awk/d_string1.awk src/tests/usr.bin/awk/d_string1.out \
src/tests/usr.bin/awk/d_tolower.awk src/tests/usr.bin/awk/d_tolower.in \
src/tests/usr.bin/awk/d_tolower.out src/tests/usr.bin/awk/d_toupper.awk \
src/tests/usr.bin/awk/d_toupper.in src/tests/usr.bin/awk/d_toupper.out
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/awk/t_awk.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/usr.bin/awk/Makefile
diff -u src/tests/usr.bin/awk/Makefile:1.1 src/tests/usr.bin/awk/Makefile:1.2
--- src/tests/usr.bin/awk/Makefile:1.1	Sat Mar 10 19:08:56 2012
+++ src/tests/usr.bin/awk/Makefile	Sun Mar 11 18:35:59 2012
@@ -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
+
+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

Index: src/tests/usr.bin/awk/t_awk.sh
diff -u src/tests/usr.bin/awk/t_awk.sh:1.2 src/tests/usr.bin/awk/t_awk.sh:1.3
--- src/tests/usr.bin/awk/t_awk.sh:1.2	Sat Mar 10 19:19:24 2012
+++ src/tests/usr.bin/awk/t_awk.sh	Sun Mar 11 18:36:01 2012
@@ -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
+}
+
 atf_test_case single_char_rs
 
 

CVS commit: src/tests/usr.bin/awk

2012-03-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Mar 10 19:19:24 UTC 2012

Modified Files:
src/tests/usr.bin/awk: t_awk.sh

Log Message:
fix typos.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/awk/t_awk.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/usr.bin/awk/t_awk.sh
diff -u src/tests/usr.bin/awk/t_awk.sh:1.1 src/tests/usr.bin/awk/t_awk.sh:1.2
--- src/tests/usr.bin/awk/t_awk.sh:1.1	Sat Mar 10 14:08:56 2012
+++ src/tests/usr.bin/awk/t_awk.sh	Sat Mar 10 14:19:24 2012
@@ -1,4 +1,4 @@
-# $NetBSD: t_awk.sh,v 1.1 2012/03/10 19:08:56 christos Exp $
+# $NetBSD: t_awk.sh,v 1.2 2012/03/10 19:19:24 christos Exp $
 #
 # Copyright (c) 2012 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -184,7 +184,7 @@ regex_caret_2_rs_head() {
 
 regex_caret_2_rs_body() {
 	atf_check \
-		-o inline:\n1a2an\n \
+		-o inline:\naa1a2a\n\n \
 		-x echo aaa1a2a | $awk 1 RS='^a'
 
 }
@@ -210,7 +210,7 @@ regex_dollar_2_rs_head() {
 
 regex_dollar_2_rs_body() {
 	atf_check \
-		-o inline:a1a2aaa\n \
+		-o inline:a1a2aaa\n\n \
 		-x echo a1a2aaa | $awk 1 RS='a$'
 
 }
@@ -237,7 +237,7 @@ empty_rs_head() {
 empty_rs_body() {
 	atf_check \
 		-o inline:foo\n \
-		-x echo foo | $awk RS=''
+		-x echo foo | $awk 1 RS=''
 
 }
 
@@ -250,7 +250,7 @@ newline_rs_head() {
 newline_rs_body() {
 	atf_check \
 		-o inline:r1f1:r1f2\nr2f1:r2f2\n \
-		-x printf '\n\n\nr1f1\nr1f2\n\nr2f1\nr2f2\n\n\n' | $awk '{$1=$1}1' RS= OFS=:
+		-x printf '\n\n\nr1f1\nr1f2\n\nr2f1\nr2f2\n\n\n' | $awk '{\$1=\$1}1' RS= OFS=:
 }
 
 atf_init_test_cases() {