diff options
| author | Vincent Prouillet | 2016-12-29 13:13:42 +0900 |
|---|---|---|
| committer | Vincent Prouillet | 2016-12-29 13:16:41 +0900 |
| commit | a0f2b4c0d4820bfdcc13c7abdfdc7802d9f6d493 (patch) | |
| tree | 75b5bc7b008ac374ac0a437de580d5eda1c67a52 /validator_derive/tests/compile-fail | |
| parent | ce9ee1ce4ac73ba7989c88c67b16243cbcec2b98 (diff) | |
| download | validator-a0f2b4c0d4820bfdcc13c7abdfdc7802d9f6d493.tar.bz2 | |
Added must_match
Diffstat (limited to 'validator_derive/tests/compile-fail')
| -rw-r--r-- | validator_derive/tests/compile-fail/must_match/field_doesnt_exist.rs | 15 | ||||
| -rw-r--r-- | validator_derive/tests/compile-fail/must_match/field_type_doesnt_match.rs | 16 |
2 files changed, 31 insertions, 0 deletions
diff --git a/validator_derive/tests/compile-fail/must_match/field_doesnt_exist.rs b/validator_derive/tests/compile-fail/must_match/field_doesnt_exist.rs new file mode 100644 index 0000000..03828e2 --- /dev/null +++ b/validator_derive/tests/compile-fail/must_match/field_doesnt_exist.rs @@ -0,0 +1,15 @@ +#![feature(proc_macro, attr_literals)] + +#[macro_use] extern crate validator_derive; +extern crate validator; +use validator::Validate; + +#[derive(Validate)] +//~^ ERROR: custom derive attribute panicked +//~^^ HELP: Invalid attribute #[validate] on field `password`: invalid argument for `must_match` validator: field doesn't exist in struct +struct Test { + #[validate(must_match = "password2")] + password: String, +} + +fn main() {} diff --git a/validator_derive/tests/compile-fail/must_match/field_type_doesnt_match.rs b/validator_derive/tests/compile-fail/must_match/field_type_doesnt_match.rs new file mode 100644 index 0000000..61c0847 --- /dev/null +++ b/validator_derive/tests/compile-fail/must_match/field_type_doesnt_match.rs @@ -0,0 +1,16 @@ +#![feature(proc_macro, attr_literals)] + +#[macro_use] extern crate validator_derive; +extern crate validator; +use validator::Validate; + +#[derive(Validate)] +//~^ ERROR: custom derive attribute panicked +//~^^ HELP: Invalid attribute #[validate] on field `password`: invalid argument for `must_match` validator: types of field can't match +struct Test { + #[validate(must_match = "password2")] + password: String, + password2: i32, +} + +fn main() {} |
