Skip to content

Commit be2b9d3

Browse files
committed
add test cases for length
1 parent 6ee2920 commit be2b9d3

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

tests/length.rs

+6-5
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@ length_less_than!(10);
77

88
#[test]
99
fn test_length() -> Result<(), refined_type::result::Error> {
10-
type Password = Refined<
11-
And<
12-
Or<LengthEqualRule5<String>, LengthGreaterThanRule5<String>>,
13-
Or<LengthLessThanRule10<String>, LengthEqualRule10<String>>,
14-
>,
10+
type Password = Refined<From5To10Rule<String>>;
11+
12+
type From5To10Rule<T> = And<
13+
Or<LengthEqualRule5<T>, LengthGreaterThanRule5<T>>,
14+
Or<LengthLessThanRule10<T>, LengthEqualRule10<T>>,
1515
>;
16+
1617
let raw_password = "password";
1718
let password = Password::new(raw_password.to_string())?;
1819
assert_eq!(password.into_value(), "password");

0 commit comments

Comments
 (0)