# !/bin/csh
# 
#	This shell script will run the UIL National Language Extension tests.
#	It repeatedly runs the file NL with various resource settings which
#	alter the search paths and file names passed to Mrm.  The test 
#	succeeds by opening the correct file(s) and fetching string(s) 
#	from the opened files such that the strings match those provided
#	on the command line as the "valid1" or "valid2" resources.
#
echo "Running NL tests...."
echo "*Testing ability to use filenames with and without .uid extension" > NL.out
NL  -valid1 NL -file1 dir1/NL.uid >> NL.out
echo " " >> NL.out
NL  -valid1 NL -file1 dir1/NL >> NL.out
echo " " >> NL.out

echo "*Copying dir1/NL.uid to /tmp/tmpNL.uid" >> NL.out
cp  dir1/NL.uid /tmp/tmpNL.uid >> NL.out

echo "*Testing ability to handle leading slash in filename" >> NL.out
NL  -valid1 NL -file1 /tmp/tmpNL.uid >> NL.out
echo " " >> NL.out
NL  -valid1 NL -file1 /tmp/tmpNL >> NL.out
echo " " >> NL.out

echo "*Testing ability to use xnlLanguage resource" >> NL.out
NL  -uidpath "dir1/rom/%L/%U" -valid1 french -file1 french1.uid -xrm "*xnlLanguage:french" >> NL.out
echo " " >> NL.out

echo "*Setting LANG environment variable" >> NL.out
setenv LANG french >> NL.out

echo "*Testing ability to use env LANG ($LANG) when no xnlLanguage specified" >> NL.out
NL  -uidpath "dir1/rom/%L/%U" -valid1 french -file1 french1.uid  >> NL.out
echo " " >> NL.out

echo "*Testing xnlLanguage precedence over env LANG (now $LANG)" >> NL.out
NL  -uidpath "dir1/rom/%L/%U" -valid1 german -file1 german.uid -xrm "*xnlLanguage:german" >> NL.out
echo " " >> NL.out

echo "*Testing uidpath with multiple entries" >> NL.out
NL -uidpath "/tmp/%U:dir1/rom/french/%U" -file1 tmpNL.uid -file2 french.uid -valid1 NL -valid2 french -filecount 2 >> NL.out
echo " " >> NL.out

echo "*Removing /tmp/tmpNL.uid" >> NL.out
rm /tmp/tmpNL.uid >> NL.out

echo "*NL tests completed" >> NL.out
echo "NL tests completed" 
