aboutsummaryrefslogtreecommitdiff
path: root/tests/test_args.rs
diff options
context:
space:
mode:
authoracdenisSK <[email protected]>2018-04-02 16:35:58 +0200
committeracdenisSK <[email protected]>2018-04-02 16:35:58 +0200
commit82e21a61ae17d8466834f486108d1ace2791efc4 (patch)
tree79b9de16850a2f8824bb7bdb71e85eab7841f423 /tests/test_args.rs
parentAdd http method to ban zeyla from a guild (diff)
downloadserenity-82e21a61ae17d8466834f486108d1ace2791efc4.tar.xz
serenity-82e21a61ae17d8466834f486108d1ace2791efc4.zip
Short-circuit on an error
And delegate most of is_empty checking to the internal parse function
Diffstat (limited to 'tests/test_args.rs')
-rw-r--r--tests/test_args.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/test_args.rs b/tests/test_args.rs
index 03103b8..6911dae 100644
--- a/tests/test_args.rs
+++ b/tests/test_args.rs
@@ -412,7 +412,8 @@ fn single_after_failed_single() {
let mut args = Args::new("b 2", &[" ".to_string()]);
assert_matches!(args.single::<i32>().unwrap_err(), ArgError::Parse(_));
- assert_eq!(args.full(), "2");
+ // Test that `single` short-circuts on an error and leaves the source as is.
+ assert_eq!(args.full(), "b 2");
}
#[test]
@@ -420,6 +421,7 @@ fn len_quoted_after_failed_single_quoted() {
let mut args = Args::new("b a", &[" ".to_string()]);
assert_eq!(args.len_quoted(), 2);
+ // Same goes for `single_quoted` and the alike.
assert_matches!(args.single_quoted::<i32>().unwrap_err(), ArgError::Parse(_));
- assert_eq!(args.len_quoted(), 1);
+ assert_eq!(args.len_quoted(), 2);
}