diff options
author | Ryan Geary <rtgnj42@gmail.com> | 2021-07-21 16:30:37 -0400 |
---|---|---|
committer | Ryan Geary <rtgnj42@gmail.com> | 2021-07-23 16:27:02 -0400 |
commit | 1970d0cc74bf25afdb71f433b0392208098f4607 (patch) | |
tree | 6b167f58430a3feacab6eb86ce10402b76350367 /test | |
parent | 03e5ca4c1d235e79f497fe91af2b33c0be013781 (diff) |
Improve error handling38-unwrap-on-empty-choice
Create choose::Error and choose::Result
Improve error propogation
Improve error printing
Add tests for negative indices
Add get_negative_start_end tests
Fixup negative choice indexing
Remove most uses of unwrap
Fixes #38
Diffstat (limited to 'test')
-rw-r--r-- | test/alphabet.txt | 19 | ||||
-rw-r--r-- | test/choose_-1.txt | 19 | ||||
-rw-r--r-- | test/choose_-2.txt | 19 | ||||
-rwxr-xr-x | test/e2e_test.sh | 2 |
4 files changed, 59 insertions, 0 deletions
diff --git a/test/alphabet.txt b/test/alphabet.txt new file mode 100644 index 0000000..83f9439 --- /dev/null +++ b/test/alphabet.txt @@ -0,0 +1,19 @@ +a +b c +d e f + +g h i +j k +l + +m +n o +p q r + +s t u +v w +x + +y + +z diff --git a/test/choose_-1.txt b/test/choose_-1.txt new file mode 100644 index 0000000..638c41d --- /dev/null +++ b/test/choose_-1.txt @@ -0,0 +1,19 @@ +a +c +f + +i +k +l + +m +o +r + +u +w +x + +y + +z diff --git a/test/choose_-2.txt b/test/choose_-2.txt new file mode 100644 index 0000000..b724d82 --- /dev/null +++ b/test/choose_-2.txt @@ -0,0 +1,19 @@ + +b +e + +h +j + + + +n +q + +t +v + + + + + diff --git a/test/e2e_test.sh b/test/e2e_test.sh index 218a5d4..18e9628 100755 --- a/test/e2e_test.sh +++ b/test/e2e_test.sh @@ -19,6 +19,8 @@ diff -w <(cargo run -- 1 3 -o % -i ${test_dir}/lorem.txt 2>/dev/null) <(cat "${t diff -w <(cargo run -- 1 3 -o '' -i ${test_dir}/lorem.txt 2>/dev/null) <(cat "${test_dir}/choose_1_3of.txt") diff -w <(cargo run -- 3:6 -c -i ${test_dir}/lorem.txt 2>/dev/null) <(cat "${test_dir}/choose_0_3_c.txt") diff -w <(cargo run -- 2 -x -i ${test_dir}/lorem.txt 2>/dev/null) <(cat "${test_dir}/choose_2_x.txt") +diff -w <(cargo run -- -1 -i ${test_dir}/alphabet.txt 2>/dev/null) <(cat "${test_dir}/choose_-1.txt") +diff -w <(cargo run -- -2 -i ${test_dir}/alphabet.txt 2>/dev/null) <(cat "${test_dir}/choose_-2.txt") # add tests for different delimiters # add tests using piping |