I am also unclear as to what this test is supposed to accomplish.

The -z test returns true if the string is an empty string. The string will be empty if $it doesn't contain the string literal '.cm'.

When I run the (system) locale utility on my (Linux) machine, I receive output similar in nature to what you observed. However, when I run the stdcxx locale utility, I receive blank (no) output. This likely is because there are no files in the nls subdirectory of my build directory at this time. I have a total of 46 assertions, compared to your 49. I suspect the difference in assertion counts is related to the contents of the this directory. I wonder if the output you listed is from the system locale utility rather than the stdcxx locale utility. (Try 'which locale' to check if you are invoking the one you wanted to. You may need to invoke the utility as './locale', depending on your $PATH variable.)

--Andrew Black

Farid Zaripov wrote:
  I can't understand what does the line "test -z "`echo $it | grep .cm`"
;" in function below?

check_locale_m()
{
    printf "Checking \"locale -m\" output..." >$dbgout
    loc_m_out=`${locale} -m`
    for it in $loc_m_out; do
        assertions=`expr $assertions + 1`
        if test -z "`echo $it | grep .cm`" ; then
            echo " incorrect." >$dbgout
            echo "ERROR: \"locale -m\" failed."  >$dbgout
            echo >$dbgout
            failedassertions=`expr $failedassertions + 1`
        fi;
    done;                                               
    echo " correct." >$dbgout
}

  I suppose that in command 'grep .cm' ".cm" is a regular expression and
grep utility should print lines that contains <anychar>cm?

  On my machine on Windows locale -m produces:
ANSI_X3.110-1983
ANSI_X3.4-1968
ASMO_449
BIG5
BIG5-HKSCS
BS_4730
BS_VIEWDATA
CP10007
CP1250
CP1251
CP1252
CP1253
CP1254
CP1255
CP1256
CP1257
CP1258
CP437
CP737
CP775
CP949
...

  I not see the lines that matches to the ".cm"  regexp. And because of
this
the sanity check fails.

Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights r

Checking "locale --help" output... correct.
Checking "locale -a" output...check completed.
Checking "locale -m" output... incorrect.
ERROR: "locale -m" failed.
Checking "locale -k LC_ALL" output... correct.
Checking "localedef --help" output... correct.
# +-----------------------+--------+--------+--------+
# | DIAGNOSTIC            | ACTIVE |  TOTAL |INACTIVE|
# +-----------------------+--------+--------+--------+
# | (S7) ASSERTION        |      1 |     49 |    98% |
# +-----------------------+--------+--------+--------+

## Assertions = 49
## FailedAssertions = 1


  Where I wrong?


Farid.

Reply via email to