mirror of
https://github.com/theryangeary/choose
synced 2024-11-23 03:13:04 +00:00
Test return value on error with e2e test
This commit is contained in:
parent
e668d9f508
commit
4eb2ed0396
1 changed files with 12 additions and 0 deletions
|
@ -6,6 +6,7 @@ orig_dir="$(pwd)"
|
|||
cd "$(git rev-parse --show-toplevel)"
|
||||
cargo build
|
||||
|
||||
# basic functionality
|
||||
diff -w <(cargo run -- 0:2 -i ${test_dir}/lorem.txt) <(cat "${test_dir}/choose_0:2.txt")
|
||||
diff -w <(cargo run -- 0 3 -i ${test_dir}/lorem.txt) <(cat "${test_dir}/choose_0_3.txt")
|
||||
diff -w <(cargo run -- :2 -i ${test_dir}/lorem.txt) <(cat "${test_dir}/choose_:2.txt")
|
||||
|
@ -15,3 +16,14 @@ diff -w <(cargo run -- 12 -i ${test_dir}/lorem.txt) <(cat "${test_dir}/choose_12
|
|||
# add test for reverse range
|
||||
# add tests for different delimiters
|
||||
# add tests using piping
|
||||
|
||||
set +e
|
||||
|
||||
# test failure to parse arguments
|
||||
cargo run -- d:i -i ${test_dir}/lorem.txt >/dev/null
|
||||
r=$?
|
||||
if [ $r -ne 2 ]; then
|
||||
echo "Failed to return error code 2 on failure to parse arguments"
|
||||
else
|
||||
echo "Success"
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue