Imported Upstream version 0.19.7
[platform/upstream/gettext.git] / gettext-tools / tests / msgunfmt-tcl-1
1 #! /bin/sh
2 . "${srcdir=.}/init.sh"; path_prepend_ . ../src
3
4 # Test of --tcl option.
5
6 # This test fails on mingw, in the Cygwin environment: tclsh exists as
7 # tclsh.exe from Cygwin. When msgunfmt invokes it, it crashes, presenting
8 # a dialog "16 bit MS-DOS subsystem - The NTVDM CPU has encountered an
9 # illegal instruction." When this dialog is closed, msgunfmt continues,
10 # reads empty output, and refrains from creating a PO file because
11 # --force-po was not specified.
12
13 # Test whether we can execute Tcl programs and Tcl's fconfigure command
14 # understands the -encoding option (it does since approximately Tcl 8.1).
15 cat <<\EOF > mu-tcl-1-version.tcl
16 fconfigure stdout -encoding utf-8
17 puts $tcl_version
18 EOF
19 (tclsh mu-tcl-1-version.tcl) >/dev/null 2>/dev/null \
20   || { echo "Skipping test: tclsh not found or Tcl too old"
21        exit 77
22      }
23
24 cat <<\EOF > mu-tcl-1-fr.po
25 msgid ""
26 msgstr "Content-Type: text/plain; charset=ISO-8859-1\n"
27
28 #: program.tcl:5
29 msgid "'Your command, please?', asked the waiter."
30 msgstr "«Votre commande, s'il vous plait», dit le garçon."
31
32 # Reverse the arguments.
33 #: program.tcl:6
34 #, tcl-format
35 msgid "%s is replaced by %s."
36 msgstr "%2$s remplace %1$s."
37 EOF
38
39 test -d mu-tcl-1-msgs || mkdir mu-tcl-1-msgs
40
41 : ${MSGFMT=msgfmt}
42 ${MSGFMT} --tcl -d mu-tcl-1-msgs -l fr mu-tcl-1-fr.po || exit 1
43
44 : ${MSGUNFMT=msgunfmt}
45 GETTEXTDATADIR="$abs_top_srcdir"/src \
46 ${MSGUNFMT} --tcl -d mu-tcl-1-msgs -l fr -o mu-tcl-1-prog.out || exit 1
47
48 cat <<\EOF > mu-tcl-1-prog.ok
49 msgid ""
50 msgstr "Content-Type: text/plain; charset=UTF-8\n"
51
52 msgid "'Your command, please?', asked the waiter."
53 msgstr "«Votre commande, s'il vous plait», dit le garçon."
54
55 msgid "%s is replaced by %s."
56 msgstr "%2$s remplace %1$s."
57 EOF
58 : ${DIFF=diff}
59 ${DIFF} mu-tcl-1-prog.ok mu-tcl-1-prog.out || exit 1
60
61 exit 0