Home | History | Annotate | Line # | Download | only in tests
lang-rst revision 1.1.1.1
      1 #! /bin/sh
      2 
      3 # Test of gettext facilities in the RST format.
      4 
      5 tmpfiles=""
      6 trap 'rm -fr $tmpfiles' 1 2 3 15
      7 
      8 tmpfiles="$tmpfiles prog.rst"
      9 cat <<\EOF > prog.rst
     10 # From the rstconv program itself.
     11 rstconv.help='rstconv [-h|--help]    Displays this help'#10+
     12 'rstconv options        Convert rst file'#10#10+
     13 'Options are:'#10+
     14 '  -i file    Use specified file instead of stdin as input .rst (OPTIONAL)'#10+
     15 '  -o file    Write output to specified file (REQUIRED)'#10+
     16 '  -f format  Specifies the output format:'#10+
     17 '             po    GNU gettext .po (portable) format (DEFAULT)'#10
     18 
     19 rstconv.InvalidOption='Invalid option - '
     20 rstconv.OptionAlreadySpecified='Option has already been specified - '
     21 rstconv.NoOutFilename='No output filename specified'
     22 rstconv.InvalidOutputFormat='Invalid output format -'
     23 EOF
     24 
     25 tmpfiles="$tmpfiles prog.pot"
     26 : ${XGETTEXT=xgettext}
     27 ${XGETTEXT} -o prog.pot --omit-header --add-location prog.rst
     28 
     29 tmpfiles="$tmpfiles prog.ok"
     30 cat <<EOF > prog.ok
     31 #: rstconv.help
     32 msgid ""
     33 "rstconv [-h|--help]    Displays this help\n"
     34 "rstconv options        Convert rst file\n"
     35 "\n"
     36 "Options are:\n"
     37 "  -i file    Use specified file instead of stdin as input .rst (OPTIONAL)\n"
     38 "  -o file    Write output to specified file (REQUIRED)\n"
     39 "  -f format  Specifies the output format:\n"
     40 "             po    GNU gettext .po (portable) format (DEFAULT)\n"
     41 msgstr ""
     42 
     43 #: rstconv.InvalidOption
     44 msgid "Invalid option - "
     45 msgstr ""
     46 
     47 #: rstconv.OptionAlreadySpecified
     48 msgid "Option has already been specified - "
     49 msgstr ""
     50 
     51 #: rstconv.NoOutFilename
     52 msgid "No output filename specified"
     53 msgstr ""
     54 
     55 #: rstconv.InvalidOutputFormat
     56 msgid "Invalid output format -"
     57 msgstr ""
     58 EOF
     59 
     60 : ${DIFF=diff}
     61 ${DIFF} prog.ok prog.pot || exit 1
     62 
     63 # The output of rstconv is slightly different:
     64 # - ModuleName:ConstName instead of ModuleName.ConstName
     65 # - no line wrapping
     66 # - extra newline at the end
     67 
     68 tmpfiles="$tmpfiles prog.pot"
     69 : ${RSTCONV=rstconv}
     70 if (${RSTCONV} -o prog.pot -i prog.rst) >/dev/null 2>&1; then
     71 
     72 tmpfiles="$tmpfiles prog.ok"
     73 cat <<EOF > prog.ok
     74 #: rstconv:help
     75 msgid "rstconv [-h|--help]    Displays this help\nrstconv options        Convert rst file\n\nOptions are:\n  -i file    Use specified file instead of stdin as input .rst (OPTIONAL)\n  -o file    Write output to specified file (REQUIRED)\n  -f format  Specifies the output format:\n             po    GNU gettext .po (portable) format (DEFAULT)\n"
     76 msgstr ""
     77 
     78 #: rstconv:InvalidOption
     79 msgid "Invalid option - "
     80 msgstr ""
     81 
     82 #: rstconv:OptionAlreadySpecified
     83 msgid "Option has already been specified - "
     84 msgstr ""
     85 
     86 #: rstconv:NoOutFilename
     87 msgid "No output filename specified"
     88 msgstr ""
     89 
     90 #: rstconv:InvalidOutputFormat
     91 msgid "Invalid output format -"
     92 msgstr ""
     93 
     94 EOF
     95 
     96 : ${DIFF=diff}
     97 ${DIFF} prog.ok prog.pot || exit 1
     98 
     99 fi
    100 
    101 rm -fr $tmpfiles
    102 
    103 exit 0
    104