about summary refs log tree commit diff
path: root/test
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2023-08-15 16:30:43 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2023-08-15 16:30:43 +0000
commitb6684711fba6652037347029deb2f09ac5342856 (patch)
tree7ab84b6c60ef3e27abdea2566f685f49f7d5f521 /test
parent27d3c9e00c4f90f73969ccb1b1c6b2bbfee7abab (diff)
downloadnetpbm-mirror-b6684711fba6652037347029deb2f09ac5342856.tar.gz
netpbm-mirror-b6684711fba6652037347029deb2f09ac5342856.tar.xz
netpbm-mirror-b6684711fba6652037347029deb2f09ac5342856.zip
cleanup
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@4587 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'test')
-rwxr-xr-xtest/pbmtext-iso88591.test26
-rwxr-xr-xtest/pbmtext-utf8.test21
2 files changed, 26 insertions, 21 deletions
diff --git a/test/pbmtext-iso88591.test b/test/pbmtext-iso88591.test
index 69e6ec90..e8dec8d2 100755
--- a/test/pbmtext-iso88591.test
+++ b/test/pbmtext-iso88591.test
@@ -1,9 +1,9 @@
-#! /bin/bash
+#! /bin/sh
 # This script tests: pbmtext
 # Also requires:
 
 # This test requires an iso-8859-1 locale
-# Skip this test if it is not available
+# Skip this test if none are available
 
 LANG=C
 LC_ALL=C
@@ -12,26 +12,29 @@ export LANG LC_ALL
 tmpdir=${tmpdir:-/tmp}
 iso88591_locale_list=${tmpdir}/iso88591_locale_list
 
-
-locale_to_test="en_US.iso88591"  # Initial value
+locale_to_test="en_US.iso88591"  # Initial value; this
+# does not have to be present in
 # Edit the above value if necessary
-  
+
 # Make a list of available locales which end in "iso88591"
-locale -a | grep "\.iso88591$" > ${iso88591_locale_list}
+# If none are found, abort test
 
-# Hunt for a valid iso-8859-1 locale  
+locale -a | grep "\.iso88591$" > ${iso88591_locale_list} ||\
+    locale_to_test=""
+
+# Hunt for a valid iso-8859-1 locale
 # Submit each candidate to a trial pbmtext run until one that works is
 # encountered
 
-i=0
 until [ -z ${locale_to_test} ] || \
   echo "A" | LC_ALL=${locale_to_test} pbmtext -wchar > /dev/null
   do
-    let i=$(($i+1));
-    locale_to_test=`sed "$i"p -n  ${iso88591_locale_list}`;
+      # Read first line of file
+      locale_to_test=`head -n 1 ${iso88591_locale_list}`;
+      # then erase the line
+      sed -i 1d ${iso88591_locale_list};
   done;
 
-rm ${iso88591_locale_list};
 if [ -z  ${locale_to_test} ]
   then echo "No iso-8859-1 locale available." 1>&2
        echo "Skipping." 1>&2
@@ -42,7 +45,6 @@ fi;
 
 locale_for_test=${locale_to_test};
 
-
 # Two rows
 # Should print 2066913605 5110 twice
 echo "Test 1"
diff --git a/test/pbmtext-utf8.test b/test/pbmtext-utf8.test
index 78dfaf9e..a10b3d33 100755
--- a/test/pbmtext-utf8.test
+++ b/test/pbmtext-utf8.test
@@ -6,9 +6,8 @@ LANG=C
 LC_ALL=C
 export LANG LC_ALL
 
-
 # This test requires a working UTF-8 locale
-# Skip this test if it is are not available
+# Skip this test if none are available
 
 iconv /dev/null
 if [ $? -ne 0  ]
@@ -20,25 +19,29 @@ fi
 tmpdir=${tmpdir:-/tmp}
 utf_locale_list=${tmpdir}/utf_locale_list
 
-locale_to_test="en_US.utf8"  # Initial value
+locale_to_test="en_US.utf8"  # Initial value; this
+# does not have to be present in  following list
 # Edit the above value if necessary
 
 # Make a list of available locales which end in "utf8"
-locale -a | grep "\.utf8$" > ${utf_locale_list}
+# If none are found, abort test
+
+locale -a | grep "\.utf8$" > ${utf_locale_list} ||\
+    locale_to_test=""
 
 # Hunt for a valid utf8 locale
 # Submit each candidate to a trial pbmtext run until one that works is
 # encountered
 
-i=0
 until [ -z ${locale_to_test} ] || \
   echo "A" | LC_ALL=${locale_to_test} pbmtext -wchar > /dev/null
     do
-      let i=$(($i+1));
-      locale_to_test=`sed "$i"p -n  ${utf_locale_list}`;
+      # Read first line of file
+      locale_to_test=`head -n 1 ${utf_locale_list}`;
+      # then erase the line
+      sed -i 1d ${utf_locale_list};
     done;
 
-rm ${utf_locale_list};
 if [ -z  ${locale_to_test} ]
   then echo "No utf-8 locale available." 1>&2
        echo "Skipping." 1>&2
@@ -115,10 +118,10 @@ awk 'BEGIN { for (i=32; i<=126;++i) printf("%c",i); print "" } '
 awk 'BEGIN { for (i=32; i<=126;++i) printf("%c",i); print ""}' | \
         LC_ALL=${locale_for_test} pbmtext -builtin bdf -wchar -text-dump
 
+
 # Test 5.
 # Long input text
 
-
 echo "Test 5 Invalid"
 
 long_txt=${tmpdir}/long.txt