NetBSD-Bugs archive

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

Re: bin/42320: LC_NUMERIC in awk is not POSIX compliant



>  Please add the atf test for this issue:

I'd like to enhance the test and check a handling of assignments in
command-line agruments:

$ cat tests/util/awk/period.awk
{print x + $1 + 0.01}
$ cat tests/util/awk/period.in
0,02
$ cat tests/util/awk/period.out
0,04
$ cvs diff tests/util/awk/t_awk.sh
Index: tests/util/awk/t_awk.sh
===================================================================
RCS file: /cvsroot/src/tests/util/awk/t_awk.sh,v
retrieving revision 1.2
diff -u -r1.2 t_awk.sh
--- tests/util/awk/t_awk.sh     4 Jun 2010 08:39:41 -0000       1.2
+++ tests/util/awk/t_awk.sh     24 Sep 2010 22:51:30 -0000
@@ -27,10 +27,12 @@
 
 h_check()
 {
+       local fname=d_$1
        for sfx in in out awk; do
-               cp -r $(atf_get_srcdir)/d_$1.$sfx .
+               cp -r $(atf_get_srcdir)/$fname.$sfx .
        done
-       atf_check -o file:d_$1.out -x "awk -f d_$1.awk < d_$1.in"
+       shift 1
+       atf_check -o file:$fname.out -x "awk $@ -f $fname.awk < $fname.in"
 }
 
 atf_test_case big_regexp
@@ -86,10 +88,25 @@
        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)"
+       atf_set "use.fs" "true"
+}
+period_body()
+{
+       export LANG=ru_RU.KOI8-R
+
+       h_check period -v x=0.01
+}
+
 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
 }


Home | Main Index | Thread Index | Old Index