Skip to content

Commit

Permalink
Address shellcheck warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
gliargovas committed Nov 16, 2023
1 parent 46b5273 commit 5f749de
Showing 1 changed file with 11 additions and 16 deletions.
27 changes: 11 additions & 16 deletions test/merge_multiple_dirs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,13 @@ cleanup() {
then
rm "$expected3"
fi

if [ -f "$expected4" ]
then
rm "$expected4"
fi
}

trap 'cleanup' EXIT

try_workspace="$(mktemp -d -p .)"
cp "$TRY_TOP/test/resources/file.txt.gz" "$try_workspace/"
cd $try_workspace
cd "$try_workspace" || return 1

try_example_dir1="$(mktemp -d)"
try_example_dir2="$(mktemp -d)"
Expand All @@ -61,16 +56,16 @@ expected2="$(mktemp)"
expected3="$(mktemp)"

touch "$expected1"
echo "test2" > $expected2
echo "test3" > $expected3
echo "test2" > "$expected2"
echo "test3" > "$expected3"

"$TRY" -D "$try_example_dir1" "touch file_1.txt; echo test > file_2.txt; rm file.txt.gz" || return 1
"$TRY" -D "$try_example_dir2" "echo test2 > file_2.txt" || return 2
"$TRY" -D "$try_example_dir3" "echo test3 > file_3.txt" || return 3
"$TRY" -L "$try_example_dir3:$try_example_dir2:$try_example_dir1" -y "cat file_1.txt > out1; cat file_2.txt > out2; cat file_3.txt > out3"|| return 4
"$TRY" -D "$try_example_dir1" "touch file_1.txt; echo test > file_2.txt; rm file.txt.gz" || return 2
"$TRY" -D "$try_example_dir2" "echo test2 > file_2.txt" || return 3
"$TRY" -D "$try_example_dir3" "echo test3 > file_3.txt" || return 4
"$TRY" -L "$try_example_dir3:$try_example_dir2:$try_example_dir1" -y "cat file_1.txt > out1; cat file_2.txt > out2; cat file_3.txt > out3"|| return 5

diff -q "$expected1" out1 || return 5
diff -q "$expected2" out2 || return 6
diff -q "$expected3" out3 || return 7
diff -q "$expected1" out1 || return 6
diff -q "$expected2" out2 || return 7
diff -q "$expected3" out3 || return 8

! [ -f out4 ] || return 8
! [ -f out4 ] || return 9

0 comments on commit 5f749de

Please sign in to comment.