Home | History | Annotate | Line # | Download | only in tests
      1  1.1  christos #! /bin/sh
      2  1.1  christos 
      3  1.1  christos # Test of --tcl option.
      4  1.1  christos 
      5  1.1  christos tmpfiles=""
      6  1.1  christos trap 'rm -fr $tmpfiles' 1 2 3 15
      7  1.1  christos 
      8  1.1  christos # Test whether we can execute Tcl programs and Tcl's fconfigure command
      9  1.1  christos # understands the -encoding option (it does since approximately Tcl 8.1).
     10  1.1  christos tmpfiles="$tmpfiles version.tcl"
     11  1.1  christos cat <<\EOF > version.tcl
     12  1.1  christos fconfigure stdout -encoding utf-8
     13  1.1  christos puts $tcl_version
     14  1.1  christos EOF
     15  1.1  christos (tclsh version.tcl) >/dev/null 2>/dev/null \
     16  1.1  christos   || { echo "Skipping test: tclsh not found or Tcl too old"
     17  1.1  christos        rm -fr $tmpfiles; exit 77
     18  1.1  christos      }
     19  1.1  christos 
     20  1.1  christos tmpfiles="$tmpfiles fr.po"
     21  1.1  christos cat <<\EOF > fr.po
     22  1.1  christos msgid ""
     23  1.1  christos msgstr "Content-Type: text/plain; charset=ISO-8859-1\n"
     24  1.1  christos 
     25  1.1  christos #: program.tcl:5
     26  1.1  christos msgid "'Your command, please?', asked the waiter."
     27  1.1  christos msgstr "Votre commande, s'il vous plait, dit le garon."
     28  1.1  christos 
     29  1.1  christos # Reverse the arguments.
     30  1.1  christos #: program.tcl:6
     31  1.1  christos #, tcl-format
     32  1.1  christos msgid "%s is replaced by %s."
     33  1.1  christos msgstr "%2$s remplace %1$s."
     34  1.1  christos EOF
     35  1.1  christos 
     36  1.1  christos tmpfiles="$tmpfiles msgs"
     37  1.1  christos test -d msgs || mkdir msgs
     38  1.1  christos 
     39  1.1  christos : ${MSGFMT=msgfmt}
     40  1.1  christos ${MSGFMT} --tcl -d msgs -l fr fr.po || exit 1
     41  1.1  christos 
     42  1.1  christos tmpfiles="$tmpfiles prog.out"
     43  1.1  christos : ${MSGUNFMT=msgunfmt}
     44  1.1  christos GETTEXTDATADIR=${top_srcdir}/src \
     45  1.1  christos ${MSGUNFMT} --tcl -d msgs -l fr -o prog.out || exit 1
     46  1.1  christos 
     47  1.1  christos tmpfiles="$tmpfiles prog.ok"
     48  1.1  christos cat <<\EOF > prog.ok
     49  1.1  christos msgid ""
     50  1.1  christos msgstr "Content-Type: text/plain; charset=UTF-8\n"
     51  1.1  christos 
     52  1.1  christos msgid "'Your command, please?', asked the waiter."
     53  1.1  christos msgstr "Votre commande, s'il vous plait, dit le garon."
     54  1.1  christos 
     55  1.1  christos msgid "%s is replaced by %s."
     56  1.1  christos msgstr "%2$s remplace %1$s."
     57  1.1  christos EOF
     58  1.1  christos : ${DIFF=diff}
     59  1.1  christos ${DIFF} prog.ok prog.out || exit 1
     60  1.1  christos 
     61  1.1  christos rm -fr $tmpfiles
     62  1.1  christos 
     63  1.1  christos exit 0
     64