|
1 | 1 | use std::collections::{BTreeMap, BTreeSet, HashMap, HashSet, LinkedList, VecDeque}; |
2 | 2 |
|
3 | | -use fortifier::{LengthError, Validate, ValidationErrors}; |
| 3 | +use fortifier::{LengthError, LengthErrorCode, Validate, ValidationErrors}; |
4 | 4 | use indexmap::{IndexMap, IndexSet}; |
5 | 5 |
|
6 | 6 | #[derive(Validate)] |
@@ -53,19 +53,71 @@ fn main() { |
53 | 53 | assert_eq!( |
54 | 54 | data.validate_sync(), |
55 | 55 | Err(ValidationErrors::from_iter([ |
56 | | - LengthDataValidationError::Str(LengthError::Min { min: 1, length: 0 }), |
57 | | - LengthDataValidationError::String(LengthError::Min { min: 1, length: 0 }), |
58 | | - LengthDataValidationError::Array(LengthError::Min { min: 1, length: 0 }), |
59 | | - LengthDataValidationError::Slice(LengthError::Min { min: 1, length: 0 }), |
60 | | - LengthDataValidationError::BTreeMap(LengthError::Min { min: 1, length: 0 }), |
61 | | - LengthDataValidationError::BTreeSet(LengthError::Min { min: 1, length: 0 }), |
62 | | - LengthDataValidationError::HashMap(LengthError::Min { min: 1, length: 0 }), |
63 | | - LengthDataValidationError::HashSet(LengthError::Min { min: 1, length: 0 }), |
64 | | - LengthDataValidationError::IndexMap(LengthError::Min { min: 1, length: 0 }), |
65 | | - LengthDataValidationError::IndexSet(LengthError::Min { min: 1, length: 0 }), |
66 | | - LengthDataValidationError::LinkedList(LengthError::Min { min: 1, length: 0 }), |
67 | | - LengthDataValidationError::Vec(LengthError::Min { min: 1, length: 0 }), |
68 | | - LengthDataValidationError::VecDeque(LengthError::Min { min: 1, length: 0 }), |
| 56 | + LengthDataValidationError::Str(LengthError::Min { |
| 57 | + code: LengthErrorCode, |
| 58 | + min: 1, |
| 59 | + length: 0 |
| 60 | + }), |
| 61 | + LengthDataValidationError::String(LengthError::Min { |
| 62 | + code: LengthErrorCode, |
| 63 | + min: 1, |
| 64 | + length: 0 |
| 65 | + }), |
| 66 | + LengthDataValidationError::Array(LengthError::Min { |
| 67 | + code: LengthErrorCode, |
| 68 | + min: 1, |
| 69 | + length: 0 |
| 70 | + }), |
| 71 | + LengthDataValidationError::Slice(LengthError::Min { |
| 72 | + code: LengthErrorCode, |
| 73 | + min: 1, |
| 74 | + length: 0 |
| 75 | + }), |
| 76 | + LengthDataValidationError::BTreeMap(LengthError::Min { |
| 77 | + code: LengthErrorCode, |
| 78 | + min: 1, |
| 79 | + length: 0 |
| 80 | + }), |
| 81 | + LengthDataValidationError::BTreeSet(LengthError::Min { |
| 82 | + code: LengthErrorCode, |
| 83 | + min: 1, |
| 84 | + length: 0 |
| 85 | + }), |
| 86 | + LengthDataValidationError::HashMap(LengthError::Min { |
| 87 | + code: LengthErrorCode, |
| 88 | + min: 1, |
| 89 | + length: 0 |
| 90 | + }), |
| 91 | + LengthDataValidationError::HashSet(LengthError::Min { |
| 92 | + code: LengthErrorCode, |
| 93 | + min: 1, |
| 94 | + length: 0 |
| 95 | + }), |
| 96 | + LengthDataValidationError::IndexMap(LengthError::Min { |
| 97 | + code: LengthErrorCode, |
| 98 | + min: 1, |
| 99 | + length: 0 |
| 100 | + }), |
| 101 | + LengthDataValidationError::IndexSet(LengthError::Min { |
| 102 | + code: LengthErrorCode, |
| 103 | + min: 1, |
| 104 | + length: 0 |
| 105 | + }), |
| 106 | + LengthDataValidationError::LinkedList(LengthError::Min { |
| 107 | + code: LengthErrorCode, |
| 108 | + min: 1, |
| 109 | + length: 0 |
| 110 | + }), |
| 111 | + LengthDataValidationError::Vec(LengthError::Min { |
| 112 | + code: LengthErrorCode, |
| 113 | + min: 1, |
| 114 | + length: 0 |
| 115 | + }), |
| 116 | + LengthDataValidationError::VecDeque(LengthError::Min { |
| 117 | + code: LengthErrorCode, |
| 118 | + min: 1, |
| 119 | + length: 0 |
| 120 | + }), |
69 | 121 | ])) |
70 | 122 | ); |
71 | 123 | } |
0 commit comments