summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgramanas <anastasis.gramm2@gmail.com>2021-02-19 13:54:49 +0200
committergramanas <anastasis.gramm2@gmail.com>2021-02-19 13:54:49 +0200
commit0ccaa814bda420a39f4a184d655fa5cb670bf964 (patch)
tree7cca9fca6790723be2df70baeda1e580cd7b82dd
parentf06d27a55b74ce0b65671bc5cbd9a65666de04d6 (diff)
downloadconf-0ccaa814bda420a39f4a184d655fa5cb670bf964.tar.gz
conf-0ccaa814bda420a39f4a184d655fa5cb670bf964.tar.bz2
conf-0ccaa814bda420a39f4a184d655fa5cb670bf964.zip
Fix test
-rwxr-xr-xconf4
-rwxr-xr-xtest.sh11
2 files changed, 11 insertions, 4 deletions
diff --git a/conf b/conf
index d831df8..853570d 100755
--- a/conf
+++ b/conf
@@ -52,7 +52,7 @@ function echo_if_test {
}
function add {
- [ $# -lt 1 ] && grep ")\ #a" "${PROGRAM_NAME}" | sed -e 's/^[[:space:]]*//' -e 's:) \#a: :g'; return 0
+ [ $# -lt 1 ] && (grep ")\ #a" "${PROGRAM_NAME}" | sed -e 's/^[[:space:]]*//' -e 's:) \#a: :g'; return 0)
GROUP=${DEF_GROUP}
@@ -88,6 +88,8 @@ function add {
[ "${MODE}" != "test" ] && mkdir -p "$(dirname "${DST}")" && mv "${SRC}" "${DST}" && ln -s "${DST}" "${SRC}"
esac
done
+
+ return 0
}
function list {
diff --git a/test.sh b/test.sh
index 6dc38e6..ef9c708 100755
--- a/test.sh
+++ b/test.sh
@@ -1,8 +1,9 @@
#!/bin/bash
-CONF=$(realpath conf)
-CONF_HOME=$(mktemp -d)
-export CONF_HOME
+set -e
+
+CONF=$(realpath ./conf)
+export CONF_HOME=$(mktemp -d)
conf1=$(mktemp)
conf2=$(mktemp)
@@ -16,9 +17,13 @@ echo "test config 3" > "$conf3"
echo "test config 4" > "$conf4"
echo "test config 5" > "$conf5"
+$CONF add -t "$conf1"
$CONF add "$conf1"
+$CONF add -t -g conf "$conf2" "$conf3"
$CONF add -g conf "$conf2" "$conf3"
+$CONF add -t -g conf "$conf4"
$CONF add -g conf "$conf4"
+$CONF add -t -g other "$conf5"
$CONF add -g other "$conf5"
[ "$($CONF ls -l | wc -l)" != "5" ] && echo Test failed