diff options
| author | acdenisSK <[email protected]> | 2018-04-02 16:35:58 +0200 |
|---|---|---|
| committer | acdenisSK <[email protected]> | 2018-04-02 16:35:58 +0200 |
| commit | 82e21a61ae17d8466834f486108d1ace2791efc4 (patch) | |
| tree | 79b9de16850a2f8824bb7bdb71e85eab7841f423 /tests/test_args.rs | |
| parent | Add http method to ban zeyla from a guild (diff) | |
| download | serenity-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.rs | 6 |
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); } |