#!/bin/sh
# $Id: pwd.sh,v 1.2 2001/10/08 17:31:00 cubbi Exp $
TESTPROG=`pwd`/../bin/pwd
CURDIR=`pwd`

# Test 0: check if it exists
if test -f $TESTPROG; then

# Test 1: check if the output of our pwd is exactly the same as of system pwd
 if test `pwd` != `$TESTPROG`; then
  echo "FAIL: $TESTPROG output not the same as \`pwd\`"
  exit
 fi

# Test 2: check if our pwd returns non-zero in a non-existing dir
 mkdir pwd_test_dir >/dev/null 2>/dev/null
 cd pwd_test_dir
 if (cd ..; rmdir pwd_test_dir); then
  if $TESTPROG >/dev/null 2>/dev/null; then
   echo "FAIL: did not return false in non-existing dir"
   cd $CURDIR
   rmdir pwd_test_dir >/dev/null 2>/dev/null
   exit
  fi
  cd $CURDIR
  rmdir pwd_test_dir >/dev/null 2>/dev/null
 fi

 echo "PASS: pwd"
else
 echo "SKIP: $TESTPROG doesn't exist"
fi
