aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--.travis/dest/1.txt (renamed from .travis/sample-dest/1.txt)0
-rw-r--r--.travis/dest/bar/3.txt (renamed from .travis/sample-dest/bar/3.txt)0
-rw-r--r--.travis/src/%DEST%/1.txt (renamed from .travis/sample-src/%DEST%/1.txt)0
-rw-r--r--.travis/src/%DEST%/bar/3.txt (renamed from .travis/sample-src/%DEST%/bar/3.txt)0
-rw-r--r--.travis/src/%DEST%/bar/baz/4.txt (renamed from .travis/sample-src/%DEST%/bar/baz/4.txt)0
-rw-r--r--.travis/src/%DEST%/foo/2.txt (renamed from .travis/sample-src/%DEST%/foo/2.txt)0
-rwxr-xr-x.travis/test.sh53
7 files changed, 26 insertions, 27 deletions
diff --git a/.travis/sample-dest/1.txt b/.travis/dest/1.txt
index 3a2e3f4..3a2e3f4 100644
--- a/.travis/sample-dest/1.txt
+++ b/.travis/dest/1.txt
diff --git a/.travis/sample-dest/bar/3.txt b/.travis/dest/bar/3.txt
index a83d1d5..a83d1d5 100644
--- a/.travis/sample-dest/bar/3.txt
+++ b/.travis/dest/bar/3.txt
diff --git a/.travis/sample-src/%DEST%/1.txt b/.travis/src/%DEST%/1.txt
index d00491f..d00491f 100644
--- a/.travis/sample-src/%DEST%/1.txt
+++ b/.travis/src/%DEST%/1.txt
diff --git a/.travis/sample-src/%DEST%/bar/3.txt b/.travis/src/%DEST%/bar/3.txt
index 00750ed..00750ed 100644
--- a/.travis/sample-src/%DEST%/bar/3.txt
+++ b/.travis/src/%DEST%/bar/3.txt
diff --git a/.travis/sample-src/%DEST%/bar/baz/4.txt b/.travis/src/%DEST%/bar/baz/4.txt
index b8626c4..b8626c4 100644
--- a/.travis/sample-src/%DEST%/bar/baz/4.txt
+++ b/.travis/src/%DEST%/bar/baz/4.txt
diff --git a/.travis/sample-src/%DEST%/foo/2.txt b/.travis/src/%DEST%/foo/2.txt
index 0cfbf08..0cfbf08 100644
--- a/.travis/sample-src/%DEST%/foo/2.txt
+++ b/.travis/src/%DEST%/foo/2.txt
diff --git a/.travis/test.sh b/.travis/test.sh
index 812a50f..a61badd 100755
--- a/.travis/test.sh
+++ b/.travis/test.sh
@@ -8,33 +8,38 @@ readonly script_dir
script_name="$( basename -- "${BASH_SOURCE[0]}" )"
readonly script_name
-readonly sample_src_dir_name='sample-src'
-readonly sample_dest_dir_name='sample-dest'
+readonly src_dir_name='src'
+readonly dest_dir_name='dest'
+readonly alt_dest_dir_name='alt_dest'
-sample_src_dir_path="$script_dir/$sample_src_dir_name"
-readonly sample_src_dir_path
-sample_dest_dir_path="$script_dir/$sample_dest_dir_name"
-readonly sample_dest_dir_path
+src_dir_path="$script_dir/$src_dir_name"
+readonly src_dir_path
+dest_dir_path="$script_dir/$dest_dir_name"
+readonly dest_dir_path
test_root_dir=
test_src_dir=
test_dest_dir=
+test_alt_dest_dir=
new_test() {
echo
echo 'New test'
test_root_dir="$( mktemp --directory )"
- test_src_dir="$test_root_dir/$sample_src_dir_name"
- test_dest_dir="$test_root_dir/$sample_dest_dir_name"
+ test_src_dir="$test_root_dir/$src_dir_name"
+ test_dest_dir="$test_root_dir/$dest_dir_name"
+ test_alt_dest_dir="$test_root_dir/$alt_dest_dir_name"
echo "Root directory: $test_root_dir"
echo "Shared directory: $test_src_dir"
echo "%DEST% directory: $test_dest_dir"
+ echo "%ALT_DEST% directory: $test_alt_dest_dir"
echo
- cp -r -- "$sample_src_dir_path" "$test_src_dir"
- cp -r -- "$sample_dest_dir_path" "$test_dest_dir"
+ cp -r -- "$src_dir_path" "$test_src_dir"
+ cp -r -- "$dest_dir_path" "$test_dest_dir"
+ cp -r -- "$dest_dir_path" "$test_alt_dest_dir"
}
verify_output() {
@@ -65,7 +70,6 @@ verify_output() {
test_update_works() {
new_test
- cd -- "$test_root_dir"
DEST="$test_dest_dir" "$script_dir/../bin/update.sh" --shared-dir "$test_src_dir"
local expected_output="$test_dest_dir->
@@ -83,7 +87,6 @@ $test_dest_dir/bar/baz/4.txt->$test_src_dir/%DEST%/bar/baz/4.txt"
test_unlink_works() {
new_test
- cd -- "$test_root_dir"
DEST="$test_dest_dir" "$script_dir/../bin/update.sh" --shared-dir "$test_src_dir"
DEST="$test_dest_dir" "$script_dir/../bin/unlink.sh" --shared-dir "$test_src_dir"
@@ -95,7 +98,6 @@ test_unlink_works() {
test_unlink_does_not_overwrite_files() {
new_test
- cd -- "$test_root_dir"
DEST="$test_dest_dir" "$script_dir/../bin/update.sh" --shared-dir "$test_src_dir"
rm -- "$test_dest_dir/bar/3.txt"
echo '+3' > "$test_dest_dir/bar/3.txt"
@@ -111,11 +113,8 @@ $test_dest_dir/bar/3.txt->"
test_shared_directory_symlinks_work() {
new_test
- cd -- "$test_src_dir"
- ln -s -- '%DEST%' '%ALT_DEST%'
- mkdir -- "$test_dest_dir-alt"
-
- DEST="$test_dest_dir" ALT_DEST="$test_dest_dir-alt" "$script_dir/../bin/update.sh" --shared-dir "$test_src_dir"
+ ln -s -- '%DEST%' "$test_src_dir/%ALT_DEST%"
+ DEST="$test_dest_dir" ALT_DEST="$test_alt_dest_dir" "$script_dir/../bin/update.sh" --shared-dir "$test_src_dir"
local expected_output
@@ -130,16 +129,16 @@ $test_dest_dir/bar/baz/4.txt->$test_src_dir/%DEST%/bar/baz/4.txt"
verify_output "$expected_output"
- expected_output="$test_dest_dir-alt->
-$test_dest_dir-alt/1.txt->$test_src_dir/%ALT_DEST%/1.txt
-$test_dest_dir-alt/foo->
-$test_dest_dir-alt/foo/2.txt->$test_src_dir/%ALT_DEST%/foo/2.txt
-$test_dest_dir-alt/bar->
-$test_dest_dir-alt/bar/3.txt->$test_src_dir/%ALT_DEST%/bar/3.txt
-$test_dest_dir-alt/bar/baz->
-$test_dest_dir-alt/bar/baz/4.txt->$test_src_dir/%ALT_DEST%/bar/baz/4.txt"
+ expected_output="$test_alt_dest_dir->
+$test_alt_dest_dir/1.txt->$test_src_dir/%ALT_DEST%/1.txt
+$test_alt_dest_dir/foo->
+$test_alt_dest_dir/foo/2.txt->$test_src_dir/%ALT_DEST%/foo/2.txt
+$test_alt_dest_dir/bar->
+$test_alt_dest_dir/bar/3.txt->$test_src_dir/%ALT_DEST%/bar/3.txt
+$test_alt_dest_dir/bar/baz->
+$test_alt_dest_dir/bar/baz/4.txt->$test_src_dir/%ALT_DEST%/bar/baz/4.txt"
- verify_output "$expected_output" "$test_dest_dir-alt"
+ verify_output "$expected_output" "$test_alt_dest_dir"
}
main() {