Skip to content

Commit 189b3aa

Browse files
committed
chore: test case.
1 parent 97f867e commit 189b3aa

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

crates/serde_valid/tests/custom_test.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -287,20 +287,20 @@ fn filed_custom_validation_using_self() {
287287
fn food_validation(kind: &str, food: &str) -> Result<(), serde_valid::validation::Error> {
288288
match kind {
289289
"cat" => {
290-
if food == "fish" {
290+
if food == "CatFood" {
291291
Ok(())
292292
} else {
293293
Err(serde_valid::validation::Error::Custom(
294-
"Cat should eat fish.".to_string(),
294+
"Cat should eat CatFood.".to_string(),
295295
))
296296
}
297297
}
298298
"dog" => {
299-
if food == "meat" {
299+
if food == "DogFood" {
300300
Ok(())
301301
} else {
302302
Err(serde_valid::validation::Error::Custom(
303-
"Dog should eat meat.".to_string(),
303+
"Dog should eat DogFood.".to_string(),
304304
))
305305
}
306306
}
@@ -319,13 +319,13 @@ fn filed_custom_validation_using_self() {
319319

320320
let cat = Pet {
321321
kind: "cat".to_string(),
322-
food: "fish".to_string(),
322+
food: "CatFood".to_string(),
323323
};
324324
assert!(cat.validate().is_ok());
325325

326326
let invalid = Pet {
327327
kind: "cat".to_string(),
328-
food: "meat".to_string(),
328+
food: "DogFood".to_string(),
329329
};
330330

331331
assert_eq!(
@@ -335,7 +335,7 @@ fn filed_custom_validation_using_self() {
335335
"properties": {
336336
"food": {
337337
"errors": [
338-
"Cat should eat fish."
338+
"Cat should eat CatFood."
339339
]
340340
}
341341
}

0 commit comments

Comments
 (0)