A2osX/TESTS/IFFILETEST.txt

182 lines
4.3 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

NEW
PREFIX
AUTO 4,1
#!/BIN/SH
#
# This script tests the File/Directory options of the
# IF script directive (-D -E -F).
#
echo "\f\n\n IF File Tests"
echo "\n\nThis script tests that the IF -F (FILE) -D"
echo "(DIRECTORY) and -E (either FILE or DIRECTORY)"
echo "options perform as expected."
echo
ECHO "Begin IF File Tests"
ECHO
IF [ -N $Log ]
ECHO "Begin IF File Tests" >> ${Log}
ELSE
SET T = 0
SET F = 0
SET P = 0
FI
# First test for $0 thats full path of this file so
# this should always work
SET T = $T + 1
IF [ -F $0 ]
Echo "IF -F $0 True: Passed"
IF [ -N $Log ]
ECHO "IF -F $0 True: Passed" >> ${Log}
SET P = $P + 1
FI
ELSE
Echo "IF -F $0 False: Failed"
IF [ -N $Log ]
ECHO "IF -F $0 False: Failed" >> ${Log}
SET F = $F + 1
FI
FI
# Next Test for BUILDTEST with -F which should be in current dir
SET T = $T + 1
IF [ -F BUILDTEST ]
Echo "IF -F BUILDTEST True: Passed"
IF [ -N $Log ]
ECHO "IF -F BUILDTEST True: Passed" >> ${Log}
SET P = $P + 1
FI
ELSE
Echo "IF -F BUILDTEST False: Failed"
IF [ -N $Log ]
ECHO "IF -F BUILDTEST False: Failed" >> ${Log}
SET F = $F + 1
FI
FI
# Next Test for BUILDTEST with -E which should be in current dir
SET T = $T + 1
IF [ -E BUILDTEST ]
Echo "IF -E BUILDTEST True: Passed"
IF [ -N $Log ]
ECHO "IF -E BUILDTEST True: Passed" >> ${Log}
SET P = $P + 1
FI
ELSE
Echo "IF -E BUILDTEST False: Failed"
IF [ -N $Log ]
ECHO "IF -E BUILDTEST False: Failed" >> ${Log}
SET F = $F + 1
FI
FI
# Next Test for BUILDTEST with -D which should fail as its a file
SET T = $T + 1
IF [ -D BUILDTEST ]
Echo "IF -D BUILDTEST True: Failed"
IF [ -N $Log ]
ECHO "IF -D BUILDTEST True: Failed" >> ${Log}
SET F = $F + 1
FI
ELSE
Echo "IF -D BUILDTEST False: Passed"
IF [ -N $Log ]
ECHO "IF -D BUILDTEST False: Passed" >> ${Log}
SET P = $P + 1
FI
FI
# Next check for TESTDIR with -D a directory created for this test
SET T = $T + 1
IF [ -D TESTDIR ]
Echo "IF -D TESTDIR True: Passed"
IF [ -N $Log ]
ECHO "IF -D TESTDIR True: Passed" >> ${Log}
SET P = $P + 1
FI
ELSE
Echo "IF -D TESTDIR False: Failed"
IF [ -N $Log ]
ECHO "IF -D TESTDIR False: Failed" >> ${Log}
SET F = $F + 1
FI
FI
# Next check for TESTDIR with -E a directory created for this test
SET T = $T + 1
IF [ -E TESTDIR ]
Echo "IF -E TESTDIR True: Passed"
IF [ -N $Log ]
ECHO "IF -E TESTDIR True: Passed" >> ${Log}
SET P = $P + 1
FI
ELSE
Echo "IF -E TESTDIR False: Failed"
IF [ -N $Log ]
ECHO "IF -E TESTDIR False: Failed" >> ${Log}
SET F = $F + 1
FI
FI
# Next check for TESTDIR with -F which should fail as its a dir
SET T = $T + 1
IF [ -F TESTDIR ]
Echo "IF -F TESTDIR True: Failed"
IF [ -N $Log ]
ECHO "IF -F TESTDIR True: Failed" >> ${Log}
SET F = $F + 1
FI
ELSE
Echo "IF -F TESTDIR False: Passed"
IF [ -N $Log ]
ECHO "IF -F TESTDIR False: Passed" >> ${Log}
SET P = $P + 1
FI
FI
# Next Test for BUILDTEST2 with -F which should fail non-existant
SET T = $T + 1
IF [ -F BUILDTEST2 ]
Echo "IF -F BUILDTEST2 True: Failed"
IF [ -N $Log ]
ECHO "IF -F BUILDTEST2 True: Failed" >> ${Log}
SET F = $F + 1
FI
ELSE
Echo "IF -F BUILDTEST2 False: Passed"
IF [ -N $Log ]
ECHO "IF -F BUILDTEST2 False: Passed" >> ${Log}
SET P = $P + 1
FI
FI
# Next Test for BUILDTEST2 with -E which should fail non-existant
SET T = $T + 1
IF [ -E BUILDTEST2 ]
Echo "IF -E BUILDTEST2 True: Failed"
IF [ -N $Log ]
ECHO "IF -E BUILDTEST2 True: Failed" >> ${Log}
SET F = $F + 1
FI
ELSE
Echo "IF -E BUILDTEST2 False: Passed"
IF [ -N $Log ]
ECHO "IF -E BUILDTEST2 False: Passed" >> ${Log}
SET P = $P + 1
FI
FI
# Next Test for BUILDTEST2 with -D which should fail non-existant
SET T = $T + 1
IF [ -D BUILDTEST2 ]
Echo "IF -D BUILDTEST2 True: Failed"
IF [ -N $Log ]
ECHO "IF -D BUILDTEST2 True: Failed" >> ${Log}
SET F = $F + 1
FI
ELSE
Echo "IF -D BUILDTEST2 False: Passed"
IF [ -N $Log ]
ECHO "IF -D BUILDTEST2 False: Passed" >> ${Log}
SET P = $P + 1
FI
FI
# Done IF File Testing
ECHO "\nEnd of IF File Tests\n"
ECHO
IF [ -N $Log ]
ECHO "End IF File Tests" >> ${Log}
FI
MAN
TEXT /MAKE/USR/SHARE/TESTS/IFFILETEST