summaryrefslogtreecommitdiffstats
path: root/src/choice/test/print_choice.rs
diff options
context:
space:
mode:
authorRyan Geary <rtgnj42@gmail.com>2022-04-23 15:16:32 -0400
committerRyan Geary <7076013+theryangeary@users.noreply.github.com>2022-04-23 17:26:21 -0400
commitbd32530e84c960897c56f856448c93e0480ffc4d (patch)
tree47828e6a78305dbdfba959a1e15697f15eaa3454 /src/choice/test/print_choice.rs
parent97b3abf5204badf60eb79be6be07285bdef83049 (diff)
Fix positive start, negative end, length 1 choice is empty
Diffstat (limited to 'src/choice/test/print_choice.rs')
-rw-r--r--src/choice/test/print_choice.rs30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/choice/test/print_choice.rs b/src/choice/test/print_choice.rs
index 31fa941..63a63b5 100644
--- a/src/choice/test/print_choice.rs
+++ b/src/choice/test/print_choice.rs
@@ -1000,3 +1000,33 @@ fn print_after_to_after_empty() {
fn print_negative_end_to_negative_end_empty() {
test_fn(vec!["choose", "-1:-1"], "", "");
}
+
+#[test]
+fn print_positive_to_following_negative() {
+ test_fn(vec!["choose", "1:-3"], "a b c d e", "b c");
+}
+
+#[test]
+fn print_positive_to_same_as_negative() {
+ test_fn(vec!["choose", "1:-4"], "a b c d e", "b");
+}
+
+#[test]
+fn print_positive_to_preceding_negative() {
+ test_fn(vec!["choose", "1:-5"], "a b c d e", "");
+}
+
+#[test]
+fn print_end_to_last_negative_is_last() {
+ test_fn(vec!["choose", "4:-1"], "a b c d e", "e");
+}
+
+#[test]
+fn print_after_end_to_last_negative_is_empty() {
+ test_fn(vec!["choose", "5:-1"], "a b c d e", "");
+}
+
+#[test]
+fn print_after_end_to_second_to_last_negative_is_empty() {
+ test_fn(vec!["choose", "5:-2"], "a b c d e", "");
+}