Skip to content

Commit

Permalink
fix: test case.
Browse files Browse the repository at this point in the history
  • Loading branch information
yassun7010 committed Jan 7, 2024
1 parent b4987e0 commit 0aa49c0
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions serde_valid/tests/custom_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,17 @@ mod parenthesized {

#[test]
fn custom_validation_is_ok() {
fn user_validation(_val: &[i32]) -> Result<(), serde_valid::validation::Error> {
fn user_validation(_val: &i32) -> Result<(), serde_valid::validation::Error> {
Ok(())
}

#[derive(Validate)]
struct TestStruct {
#[validate(custom(user_validation))]
val: Vec<i32>,
val: i32,
}

let s = TestStruct {
val: vec![1, 2, 3, 4],
};
let s = TestStruct { val: 1 };
assert!(s.validate().is_ok());
}

Expand Down

0 comments on commit 0aa49c0

Please sign in to comment.