aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/test/unit/test.sh
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2023-02-04 12:31:31 +0100
committerEgor Tensin <Egor.Tensin@gmail.com>2023-02-04 12:31:31 +0100
commitc1f4b790c458f0de368f32487a007d571858207c (patch)
tree45d7293ea14d0b4249e2e286327b4d8490ff563e /test/unit/test.sh
parentdebian/README: update (diff)
parentt/i: call links-update twice, just in case (diff)
downloadconfig-links-c1f4b790c458f0de368f32487a007d571858207c.tar.gz
config-links-c1f4b790c458f0de368f32487a007d571858207c.zip
Merge tag 'v2.0.3' into debian
Diffstat (limited to '')
-rwxr-xr-xtest/unit/test.sh (renamed from test/test.sh)23
1 files changed, 19 insertions, 4 deletions
diff --git a/test/test.sh b/test/unit/test.sh
index 05c5d65..f693aa1 100755
--- a/test/test.sh
+++ b/test/unit/test.sh
@@ -1,7 +1,8 @@
#!/usr/bin/env bash
set -o errexit -o nounset -o pipefail
-shopt -s inherit_errexit lastpipe
+shopt -s inherit_errexit 2> /dev/null || true
+shopt -s lastpipe
script_dir="$( dirname -- "${BASH_SOURCE[0]}" )"
script_dir="$( cd -- "$script_dir" && pwd )"
@@ -9,6 +10,9 @@ readonly script_dir
script_name="$( basename -- "${BASH_SOURCE[0]}" )"
readonly script_name
+root_dir="$( git -C "$script_dir" rev-parse --show-toplevel )"
+readonly root_dir
+
readonly src_dir_name='src'
readonly dest_dir_name='dest'
readonly alt_dest_dir_name='alt_dest'
@@ -62,15 +66,15 @@ call_bin_script() {
}
call_update() {
- call_bin_script "$script_dir/../links-update" "$@"
+ call_bin_script "$root_dir/links-update" "$@"
}
call_remove() {
- call_bin_script "$script_dir/../links-remove"
+ call_bin_script "$root_dir/links-remove"
}
call_chmod() {
- call_bin_script "$script_dir/../links-chmod" "$@"
+ call_bin_script "$root_dir/links-chmod" "$@"
}
verify_output() {
@@ -413,7 +417,18 @@ $test_dest_dir/foo/2.txt->$test_src_dir/%DEST%/foo/2.txt"
verify_mode "$expected_mode" "$test_src_dir/%DEST%/1.txt"
}
+show_env() {
+ echo
+ echo ======================================================================
+ echo Environment
+ echo ======================================================================
+
+ bash --version
+}
+
main() {
+ show_env
+
test_update_works
test_remove_works
test_remove_does_not_overwrite_files