#!/bin/sh

realpath=../realpath
pwd=$(pwd -P)

while read p q ; do
case "$q" in
#ENOENT) q="No such file or directory" ;;
#ENOTDIR) q="Not a directory" ;;
..*) q=${pwd%/*}${q#..} ;;
.*) q=$pwd${q#.} ;;
esac
r=$($realpath "$p")
test "$r" = "$q" || printf "%s -> %s (expected %s)\n" "$p" "$r" "$q"
done < ../testcases.txt
