Added test to cover #50

Changes:
1. Fixed typo in `add -h`
2. Removed unused function from `usage`
pull/42/merge
sobolevn 8 years ago
parent d9b5895bbe
commit e1a627d36a
No known key found for this signature in database
GPG Key ID: FF672D568AE3C73E

@ -8,7 +8,7 @@ function add {
while getopts "ih" opt; do
case "$opt" in
i) auto_add=1;;
h) _show_manaul_for "add";;
h) _show_manual_for "add";;
esac
done

@ -1,19 +1,6 @@
#!/usr/bin/env bash
function _show_help_usage {
cat <<-EOF
usage: git secret usage
prints all the available commands.
options:
-h shows this help.
EOF
exit 0
}
function usage {
OPTIND=1

@ -59,6 +59,22 @@ function teardown {
}
@test "run 'add' for file in subdirectory" {
local TEST_FILE='test_file'
local TEST_DIR='test_dir'
mkdir "$TEST_DIR"
touch "$TEST_DIR/$TEST_FILE"
echo "content" > "$TEST_DIR/$TEST_FILE"
echo "$TEST_DIR/$TEST_FILE" > ".gitignore"
run git secret add "$TEST_DIR/$TEST_FILE"
rm -rf "$TEST_DIR"
[ "$status" -eq 0 ]
}
@test "run 'add' twice for one file" {
local filename="local_file"
echo "content" > "$filename"

Loading…
Cancel
Save