# !/bin/csh
# Motif
#
# Copyright (c) 1987-2012, The Open Group. All rights reserved.
#
# These libraries and programs are free software; you can
# redistribute them and/or modify them under the terms of the GNU
# Lesser General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option)
# any later version.
#
# These libraries and programs are distributed in the hope that
# they will be useful, but WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU Lesser General Public License for more
# details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with these librararies and programs; if not, write
# to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
# Floor, Boston, MA 02110-1301 USA
#
# HISTORY

# 
#	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 "*Setting LANG environment variable to french" >> NL.out
setenv LANG french >> NL.out

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

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

echo "*Testing ability to use env LANG (now $LANG)" >> NL.out
NL  -uidpath "dir1/rom/%L/%U" -valid1 german -file1 german.uid  >> 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 "*Unsetting LANG environment variable" >> NL.out
unsetenv LANG >> 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" 
