From f01d70d1f9a21b84776b6f92df0bd6e6c356cd61 Mon Sep 17 00:00:00 2001 From: Sharad Chand Date: Sun, 18 Mar 2018 09:17:35 +0545 Subject: Added complex tests --- validator_derive/tests/complex.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'validator_derive/tests/complex.rs') diff --git a/validator_derive/tests/complex.rs b/validator_derive/tests/complex.rs index 0bd74fa..0a4c5f0 100644 --- a/validator_derive/tests/complex.rs +++ b/validator_derive/tests/complex.rs @@ -81,6 +81,10 @@ fn test_can_validate_option_fields_with_lifetime() { struct PutStruct<'a> { #[validate(length(min = "1", max = "10"))] name: Option<&'a str>, + #[validate(length(min = "1", max = "10"))] + address: Option>, + #[validate(range(min = "1", max = "100"))] + age: Option>, #[validate(range(min = "1", max = "10"))] range: Option, #[validate(email)] @@ -101,6 +105,8 @@ fn test_can_validate_option_fields_with_lifetime() { let s = PutStruct { name: Some("al"), + address: Some(Some("gol")), + age: Some(Some(20)), range: Some(2), email: Some("hi@gmail.com"), url: Some("http://google.com"), @@ -122,7 +128,11 @@ fn test_can_validate_option_fields_without_lifetime() { #[validate(length(min = "1", max = "10"))] name: Option, #[validate(length(min = "1", max = "10"))] + address: Option>, + #[validate(length(min = "1", max = "10"))] ids: Option>, + #[validate(range(min = "1", max = "100"))] + age: Option>, #[validate(range(min = "1", max = "10"))] range: Option, #[validate(email)] @@ -143,7 +153,9 @@ fn test_can_validate_option_fields_without_lifetime() { let s = PutStruct { name: Some("al".to_string()), + address: Some(Some("gol".to_string())), ids: Some(vec![1, 2, 3]), + age: Some(Some(20)), range: Some(2), email: Some("hi@gmail.com".to_string()), url: Some("http://google.com".to_string()), -- cgit v1.2.3