#!/bin/bash # $HeadURL$ $LastChangedRevision$ PROGNAME=${0##*/} SANDPIT=$(pwd) . $(ade-config ade_share_prefix)/include/adetestsupport.sh ############################################################################## # # Purpose of test: to check that ade_get_absolute_path does the right things. # ############################################################################## THINGS=( / /.. /././. /../../.. /a/b/c /a/b/../c /a/b/../../c /a/b/c/../../../d //////a/b/c/..///////./././ /../../../a ) for THING in "${THINGS[@]}"; do for SCRIPT_LANG in shell perl python; do printf "%-40s" "$SCRIPT_LANG:$THING:" case $SCRIPT_LANG in shell) adeshf "ade_get_absolute_path ERRSTACK \"$THING\" \"\" ABS_THING; echo \"\$ABS_THING\"; return \$ADE_OK" ;; perl) adeperlf "my(\$abs_thing, \$rc); \$rc = ADE::get_absolute_path([], \"$THING\", undef, \\\$abs_thing); print \"\$abs_thing\\n\"; return \$rc;" ;; python) adepyf "import ade; rc, abs_thing = ade.get_absolute_path([], \"$THING\", None); print(abs_thing); return rc" ;; esac done done echo "end of tests"