Home | History | Annotate | Line # | Download | only in tests
      1 #! /bin/sh
      2 
      3 # Test recode-sr-latin on some input in UTF-8 encoding.
      4 
      5 tmpfiles=""
      6 trap 'rm -fr $tmpfiles' 1 2 3 15
      7 
      8 # Test whether a specific UTF-8 locale is installed.
      9 : ${LOCALE_FR_UTF8=fr_FR.UTF-8}
     10 if test $LOCALE_FR_UTF8 != none; then
     11   LC_ALL=$LOCALE_FR_UTF8 ./testlocale 2>/dev/null
     12   case $? in
     13     0) ;;
     14     77) LOCALE_FR_UTF8=none;;
     15     *) exit 1;;
     16   esac
     17 fi
     18 if test $LOCALE_FR_UTF8 = none; then
     19   if test -f /usr/bin/localedef; then
     20     echo "Skipping test: no french UTF-8 locale is installed"
     21   else
     22     echo "Skipping test: no french UTF-8 locale is supported"
     23   fi
     24   rm -fr $tmpfiles; exit 77
     25 fi
     26 
     27 tmpfiles="$tmpfiles rec-srl-1.in"
     28 cat <<\EOF > rec-srl-1.in
     29   
     30  
     31 EOF
     32 
     33 tmpfiles="$tmpfiles rec-srl-1.out"
     34 : ${RECODE=recode}
     35 LC_ALL=$LOCALE_FR_UTF8 \
     36 ${RECODE}-sr-latin < rec-srl-1.in > rec-srl-1.out \
     37   || { rm -fr $tmpfiles; exit 1; }
     38 
     39 tmpfiles="$tmpfiles rec-srl-1.ok"
     40 cat <<\EOF > rec-srl-1.ok
     41 Ispravni argumenti su
     42 nejednoznaan argument
     43 EOF
     44 
     45 : ${DIFF=diff}
     46 ${DIFF} rec-srl-1.ok rec-srl-1.out
     47 result=$?
     48 
     49 rm -fr $tmpfiles
     50 
     51 exit $result
     52