# Tests for catrez command; invoked by command file "fulltests"
#   Written by Dave Tribby (August 1997)
#   $Id: dotests,v 1.1 1997/09/30 05:09:25 gdr Exp $

# Location of the catrez command to be tested
set testcmd="../catrez"

# Record starting time
echo -n "Testing command $testcmd beginning at"
date

# Name of test resource file
set testfile="testcr"

# The following file is the source for testcr.rez:
#     #include "types.rez"
#     resource rPString (1,protected)
#      {"This should be a protected Pascal string"};
#     resource rPString (2)
#      {"This is an unprotected Pascal string"};
# Create testcr.r with the following:
#     occ testcr.rez

echo "Creating copy of $testfile.r with $testcmd"
$testcmd -d /tmp/$testfile.r2  $testfile.r
echo "  Completion status = $status"
echo "Creating listings of original and duplicated resources"
derez $testfile.r types.rez > /tmp/$testfile.l1
derez /tmp/$testfile.r2 types.rez > /tmp/$testfile.l2
echo ""
echo "Comparing listing of original and duplicate files"
cmp /tmp/$testfile.l1 /tmp/$testfile.l2
echo "  Completion status = $status"
echo ""

echo "Getting version information"
set cmp="version.out"
set dest="/tmp/$cmp"
$testcmd > $dest
cmp $cmp $dest
echo "  Completion status = $status"
echo ""

echo "***** Error Messages *****"

set dest="/tmp/err.cond"

echo ""
echo "Expected errors: illegal option"
echo "                 option requires an argument"
echo "                 No destination filename provided"
$testcmd -x -d
echo "  Error completion status = $status (expected: 1)"

echo ""
set src="badname"
echo "Expected error opening resource fork of $src"
$testcmd -d $dest $src
echo "  Error completion status = $status (expected: 1)"
