Skip to content

Commit

Permalink
Fixing negative assertion in functional tests
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanoj3 committed Aug 4, 2019
1 parent f215e64 commit b9ce7a3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion functional-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function assert_not_contains {
local contains=$2
local msg=$3

if ! echo "$actual" | grep -v "$contains" > /dev/null; then
if printf -- '%s' "$actual" | egrep -q -- "$contains"; then
echo "ERROR: $msg"
echo "Failed to assert that $actual does not contain $contains"
exit 1;
Expand Down Expand Up @@ -83,6 +83,8 @@ assert_contains "$SCAN_RESULT" "\-\-threads" "threads help is expected to be pri
assert_contains "$SCAN_RESULT" "\-\-user-agent" "user-agent help is expected to be printed"
assert_contains "$SCAN_RESULT" "\-\-scan-depth" "scan-depth help is expected to be printed"

assert_not_contains "$SCAN_RESULT" "error" "no error is expected when priting scan help"

DICTIONARY_GENERATE_RESULT=$(./dist/dirstalk dictionary.generate resources/tests 2>&1 || true);
assert_contains "$DICTIONARY_GENERATE_RESULT" "dictionary.txt" "dictionary generation should contains a file in the folder"
assert_not_contains "$DICTIONARY_GENERATE_RESULT" "error" "no error is expected when generating a dictionary successfully"

0 comments on commit b9ce7a3

Please sign in to comment.