summaryrefslogtreecommitdiff
path: root/tests/misc/realpath
diff options
context:
space:
mode:
Diffstat (limited to 'tests/misc/realpath')
-rwxr-xr-xtests/misc/realpath10
1 files changed, 6 insertions, 4 deletions
diff --git a/tests/misc/realpath b/tests/misc/realpath
index 1b83a0496..9484ac4c8 100755
--- a/tests/misc/realpath
+++ b/tests/misc/realpath
@@ -43,11 +43,8 @@ ln -s /// three || framework_failure_
realpath -Pqz . >/dev/null || fail=1
# Operand is required
realpath >/dev/null && fail=1
-# --relative-base and --relative-to require params
realpath --relative-base . --relative-to . && fail=1
-# --relative-base requires --relative-to
-realpath --relative-base=dir1 . && fail=1
-realpath --relative-base --relative-to=dir1 . && fail=1
+realpath --relative-base . && fail=1
# -e --relative-* require directories
realpath -e --relative-to=dir1/f --relative-base=. . && fail=1
@@ -78,6 +75,11 @@ out=$(realpath -sm --relative-base=/usr --relative-to=/usr /tmp /usr) || fail=1
test "$out" = "/tmp$nl." || fail=1
out=$(realpath -sm --relative-base=/ --relative-to=/ / /usr) || fail=1
test "$out" = ".${nl}usr" || fail=1
+# --relative-to defaults to the value of --relative-base
+out=$(realpath -sm --relative-base=/usr /tmp /usr) || fail=1
+test "$out" = "/tmp$nl." || fail=1
+out=$(realpath -sm --relative-base=/ / /usr) || fail=1
+test "$out" = ".${nl}usr" || fail=1
# For now, --relative-base must be a prefix of --relative-to, or all output
# will be absolute (compare to MacOS 'relpath -d dir start end').
out=$(realpath -sm --relative-base=/usr/local --relative-to=/usr \