-
Notifications
You must be signed in to change notification settings - Fork 528
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
18 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,26 @@ | ||
#!/bin/bash | ||
# add more tests | ||
# that can be easily added in tests_ok/ and tests_failed/ | ||
# Add ad-hoc tests that can't be easily added in tests_ok/ nor tests_failed/ | ||
|
||
function assert_equals() { | ||
if [ "$1" != "$2" ]; then | ||
echo "Error differs:" | ||
echo "actual: $1" | ||
echo "expected: $2" | ||
exit 1 | ||
fi | ||
} | ||
|
||
echo "Check file not found error" | ||
actual=$(hurl does_not_exist.hurl 2>&1) | ||
expected="error: hurl: cannot access 'does_not_exist.hurl': No such file or directory" | ||
if [ "$actual" != "$expected" ]; then | ||
echo "Error differs:" | ||
echo "actual: $actual" | ||
echo "expected: $expected" | ||
exit 1 | ||
fi | ||
assert_equals "$actual" "$expected" | ||
|
||
echo "Check multiple Hurl files" | ||
actual=$(hurl tests_ok/hello.hurl tests_ok/hello.hurl) | ||
expected="Hello World!Hello World!" | ||
if [ "$actual" != "$expected" ]; then | ||
echo "Error differs:" | ||
echo "actual: $actual" | ||
echo "expected: $expected" | ||
exit 1 | ||
fi | ||
assert_equals "$actual" "$expected" | ||
|
||
echo "Check stdin" | ||
actual=$(echo 'GET http://localhost:8000/hello' | hurl) | ||
expected="Hello World!" | ||
assert_equals "$actual" "$expected" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters