Move the existing tests from util/awk to usr.bin/awk.
This commit is contained in:
parent
cd1964dea0
commit
d4c54b86b3
@ -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
|
||||
|
||||
.include <bsd.test.mk>
|
||||
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>
|
16
tests/usr.bin/awk/d_assign_NF.awk
Normal file
16
tests/usr.bin/awk/d_assign_NF.awk
Normal file
@ -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 "`"
|
||||
}
|
1
tests/usr.bin/awk/d_assign_NF.in
Normal file
1
tests/usr.bin/awk/d_assign_NF.in
Normal file
@ -0,0 +1 @@
|
||||
1 2 3
|
9
tests/usr.bin/awk/d_assign_NF.out
Normal file
9
tests/usr.bin/awk/d_assign_NF.out
Normal file
@ -0,0 +1,9 @@
|
||||
$0=`1 2`
|
||||
$3=``
|
||||
$4=``
|
||||
$0=`1 2 `
|
||||
$3=``
|
||||
$4=``
|
||||
$0=`1 2 `
|
||||
$3=``
|
||||
$4=``
|
3
tests/usr.bin/awk/d_big_regexp.awk
Normal file
3
tests/usr.bin/awk/d_big_regexp.awk
Normal file
@ -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))*$/
|
1
tests/usr.bin/awk/d_big_regexp.in
Normal file
1
tests/usr.bin/awk/d_big_regexp.in
Normal file
@ -0,0 +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
|
1
tests/usr.bin/awk/d_big_regexp.out
Normal file
1
tests/usr.bin/awk/d_big_regexp.out
Normal file
@ -0,0 +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
|
5
tests/usr.bin/awk/d_end1.awk
Normal file
5
tests/usr.bin/awk/d_end1.awk
Normal file
@ -0,0 +1,5 @@
|
||||
# $NetBSD: d_end1.awk,v 1.1 2012/03/11 18:36:00 jruoho Exp $
|
||||
|
||||
END {
|
||||
print NF;
|
||||
}
|
1
tests/usr.bin/awk/d_end1.in
Normal file
1
tests/usr.bin/awk/d_end1.in
Normal file
@ -0,0 +1 @@
|
||||
a b c d
|
1
tests/usr.bin/awk/d_end1.out
Normal file
1
tests/usr.bin/awk/d_end1.out
Normal file
@ -0,0 +1 @@
|
||||
4
|
5
tests/usr.bin/awk/d_end2.awk
Normal file
5
tests/usr.bin/awk/d_end2.awk
Normal file
@ -0,0 +1,5 @@
|
||||
# $NetBSD: d_end2.awk,v 1.1 2012/03/11 18:36:00 jruoho Exp $
|
||||
|
||||
END {
|
||||
print $0;
|
||||
}
|
1
tests/usr.bin/awk/d_end2.in
Normal file
1
tests/usr.bin/awk/d_end2.in
Normal file
@ -0,0 +1 @@
|
||||
a b c d
|
1
tests/usr.bin/awk/d_end2.out
Normal file
1
tests/usr.bin/awk/d_end2.out
Normal file
@ -0,0 +1 @@
|
||||
a b c d
|
1
tests/usr.bin/awk/d_period.awk
Normal file
1
tests/usr.bin/awk/d_period.awk
Normal file
@ -0,0 +1 @@
|
||||
{print x + $1 + 0.125}
|
1
tests/usr.bin/awk/d_period.in
Normal file
1
tests/usr.bin/awk/d_period.in
Normal file
@ -0,0 +1 @@
|
||||
0,25
|
1
tests/usr.bin/awk/d_period.out
Normal file
1
tests/usr.bin/awk/d_period.out
Normal file
@ -0,0 +1 @@
|
||||
0,875
|
7
tests/usr.bin/awk/d_string1.awk
Normal file
7
tests/usr.bin/awk/d_string1.awk
Normal file
@ -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"
|
||||
}
|
2
tests/usr.bin/awk/d_string1.out
Normal file
2
tests/usr.bin/awk/d_string1.out
Normal file
@ -0,0 +1,2 @@
|
||||
AB
|
||||
CD
|
5
tests/usr.bin/awk/d_tolower.awk
Normal file
5
tests/usr.bin/awk/d_tolower.awk
Normal file
@ -0,0 +1,5 @@
|
||||
# $NetBSD: d_tolower.awk,v 1.1 2012/03/11 18:36:00 jruoho Exp $
|
||||
|
||||
END {
|
||||
print tolower($0);
|
||||
}
|
1
tests/usr.bin/awk/d_tolower.in
Normal file
1
tests/usr.bin/awk/d_tolower.in
Normal file
@ -0,0 +1 @@
|
||||
ABCÆØÅ
|
1
tests/usr.bin/awk/d_tolower.out
Normal file
1
tests/usr.bin/awk/d_tolower.out
Normal file
@ -0,0 +1 @@
|
||||
abcæøå
|
5
tests/usr.bin/awk/d_toupper.awk
Normal file
5
tests/usr.bin/awk/d_toupper.awk
Normal file
@ -0,0 +1,5 @@
|
||||
# $NetBSD: d_toupper.awk,v 1.1 2012/03/11 18:36:01 jruoho Exp $
|
||||
|
||||
END {
|
||||
print toupper($0);
|
||||
}
|
1
tests/usr.bin/awk/d_toupper.in
Normal file
1
tests/usr.bin/awk/d_toupper.in
Normal file
@ -0,0 +1 @@
|
||||
abcæøå
|
1
tests/usr.bin/awk/d_toupper.out
Normal file
1
tests/usr.bin/awk/d_toupper.out
Normal file
@ -0,0 +1 @@
|
||||
ABCÆØÅ
|
@ -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
|
||||
|
||||
single_char_rs_head() {
|
||||
@ -254,6 +337,14 @@ newline_rs_body() {
|
||||
}
|
||||
|
||||
atf_init_test_cases() {
|
||||
|
||||
atf_add_test_case big_regexp
|
||||
atf_add_test_case end
|
||||
atf_add_test_case string1
|
||||
atf_add_test_case multibyte
|
||||
atf_add_test_case period
|
||||
atf_add_test_case assign_NF
|
||||
|
||||
atf_add_test_case single_char_rs
|
||||
atf_add_test_case two_char_rs
|
||||
atf_add_test_case single_char_regex_group_rs
|
||||
|
Loading…
Reference in New Issue
Block a user