Skip to content

Commit

Permalink
add: test
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronaut committed Oct 8, 2024
1 parent 41e0939 commit 4aed892
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
4 changes: 2 additions & 2 deletions diffdir
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ DESTINATION_DIR=$2

# Check if the source directory exists
if [ ! -d "$SOURCE_DIR" ]; then
echo "Error: Directory $SOURCE_DIR does not exist."
echo "Error: Source Directory $SOURCE_DIR does not exist."
exit 1
fi

# Check if the destination directory exists
if [ ! -d "$DESTINATION_DIR" ]; then
echo "Error: Directory $DESTINATION_DIR does not exist."
echo "Error: Destination Directory $DESTINATION_DIR does not exist."
exit 1
fi

Expand Down
13 changes: 13 additions & 0 deletions test/test_diffdir.bats
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,17 @@ setup() {
@test "show Usage" {
run diffdir
assert_output "Usage: $CURRENT_DIR/../diffdir <source_directory> <destination_directory>"
assert_failure
}

@test "source directory does not exist" {
run diffdir /ThisFolderDoseNotExist /
assert_output "Error: Source Directory /ThisFolderDoseNotExist does not exist."
assert_failure
}

@test "destination directory does not exist" {
run diffdir / /ThisFolderDoseNotExist
assert_output "Error: Destination Directory /ThisFolderDoseNotExist does not exist."
assert_failure
}

0 comments on commit 4aed892

Please sign in to comment.