iankelling.org
/
git
/
lnf
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
several bug fixes, simplify to just one script file
[lnf]
/
test
/
test
diff --git
a/test/test
b/test/test
index afbb6306a3fed7172407340f09a3a964cd9fbc96..692938a4e26ec6faeeb8713d4fe63e8fded309a0 100755
(executable)
--- a/
test/test
+++ b/
test/test
@@
-12,14
+12,14
@@
case1() {
touch b
lnf -T a b
case1() {
touch b
lnf -T a b
- [[ -L b ]]
+ [[ -L b ]]
}
# 2 arguments, test that directory in link location is removed and replaced with a link
case2() {
mkdir b
lnf -T a b
}
# 2 arguments, test that directory in link location is removed and replaced with a link
case2() {
mkdir b
lnf -T a b
- [[ -L b ]]
+ [[ -L b ]]
}
# single argument, test that an existing non-empty directory is removed and replaced by a link
}
# single argument, test that an existing non-empty directory is removed and replaced by a link
@@
-27,7
+27,7
@@
case3() {
mkdir a
touch a/b
lnf ../a
mkdir a
touch a/b
lnf ../a
- [[ -L a ]]
+ [[ -L a ]]
}
# 4 arguments, 2 of the link locations already contain files.
}
# 4 arguments, 2 of the link locations already contain files.
@@
-37,14
+37,14
@@
case4() {
touch a/b
touch a/c
lnf b c d a
touch a/b
touch a/c
lnf b c d a
- [[ -L a/b && -L a/c && -L a/d ]]
+ [[ -L a/b && -L a/c && -L a/d ]]
}
# 2 arguments, test that link is made correctly
case5() {
mkdir b
lnf a b
}
# 2 arguments, test that link is made correctly
case5() {
mkdir b
lnf a b
- [[ -L b/a ]]
+ [[ -L b/a ]]
}
}
@@
-61,7
+61,8
@@
docases() {
done
}
done
}
-source ${0%/*}/../lnf-function
+PATH="$(readlink -f ${0%/*}/..):$PATH"
+
# might want to undo this if things go wrong
# set -x
# might want to undo this if things go wrong
# set -x
@@
-69,12
+70,13
@@
source ${0%/*}/../lnf-function
set -E;
trap 'echo "${BASH_COMMAND:+BASH_COMMAND=\"$BASH_COMMAND\" }
${FUNCNAME:+FUNCNAME=\"$FUNCNAME\" }${LINENO:+LINENO=\"$LINENO\" }\$?=$?"' ERR
set -E;
trap 'echo "${BASH_COMMAND:+BASH_COMMAND=\"$BASH_COMMAND\" }
${FUNCNAME:+FUNCNAME=\"$FUNCNAME\" }${LINENO:+LINENO=\"$LINENO\" }\$?=$?"' ERR
-cd $(mktemp -d)
+tempdir=$(mktemp -d)
+cd $tempdir
docases
# test again, using rm -rf in place of trash-put.
docases
# test again, using rm -rf in place of trash-put.
-# assumes that rm is in /bin and trash-put is in /usr/bin
-PATH="${PATH//:\/usr\/bin}"
-PATH="${PATH//\/usr\/bin:}"
+trash-put() { rm -rf -- "$@"; }
+export -f trash-put
docases
docases
+rm -rf $tempdir
echo tests concluded
echo tests concluded