From 6e8effdaa2b47f4056a00d301a9e7a5a1a2fd8dc Mon Sep 17 00:00:00 2001 From: Caroline Glassberg-Powell Date: Sun, 28 Apr 2019 18:45:40 +0100 Subject: Issue #69: Change `range` to require only one arg Currently range is hard-coded to take both max and min. This is unhelpful in cases where we may only want to check one of the bounds. Update so that it behaves more like the `length` validator and can take either max or min, as well as both. Also ensure that at least one of them is supplied. --- validator_derive/tests/run-pass/range.rs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'validator_derive/tests/run-pass') diff --git a/validator_derive/tests/run-pass/range.rs b/validator_derive/tests/run-pass/range.rs index e35f3df..520dd64 100644 --- a/validator_derive/tests/run-pass/range.rs +++ b/validator_derive/tests/run-pass/range.rs @@ -24,6 +24,10 @@ struct Test { s8: u8, #[validate(range(min = 18.0, max = 22))] s9: Option, + #[validate(range(min = 18.0))] + s10: Option, + #[validate(range(max = 18.0))] + s11: Option, } fn main() {} -- cgit v1.2.3