mirror of
https://github.com/coreutils/coreutils.git
synced 2026-10-28 09:44:34 +08:00
tests: ln: test --force with a missing target
* tests/ln/misc.sh: Use getlimits_. Check the behavior of 'ln -f' with a missing target an existing file and a file where the link would be placed.
This commit is contained in:
1 parent
064473118c
commit
5f6c02d344
1 file changed
+13
@@ -18,6 +18,7 @@
|
||||
|
||||
. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
|
||||
print_ver_ ln
|
||||
getlimits_
|
||||
|
||||
t=tln-symlink
|
||||
d=tln-subdir
|
||||
@@ -96,6 +97,18 @@ ln --no-dereference -fs "$af" $ld || fail=1
|
||||
test -f $ld || fail=1
|
||||
rm -rf $d $f $ld
|
||||
|
||||
# Test that 'ln -f' doesn't overwrite a file with a link when the
|
||||
# target does not exist.
|
||||
cat <<EOF >exp || framework_failure_
|
||||
ln: failed to access 'missing': $ENOENT
|
||||
EOF
|
||||
echo a > $f || framework_failure_
|
||||
cp $f exp-$f || framework_failure_
|
||||
returns_ 1 ln -f missing $f >out 2>err || fail=1
|
||||
compare /dev/null out || fail=1
|
||||
compare exp err || fail=1
|
||||
compare exp-$f $f || fail=1
|
||||
|
||||
# -f on a existing file should not generate an error
|
||||
rm -rf $d $f
|
||||
touch $f || framework_failure_
|
||||
|
||||
Reference in new issue
Block a user