diff options
| author | Vincent Prouillet | 2017-01-16 20:56:05 +0900 |
|---|---|---|
| committer | Vincent Prouillet | 2017-01-16 20:56:05 +0900 |
| commit | ade9820f497d678296530bbf13bb4de46253d0fe (patch) | |
| tree | ab821e4d55e1fd2af4d0ef22e5c2336ba69343cf /validator_derive/tests/run-pass | |
| parent | 3302d261744c12001ec2cd980fffd32a829185aa (diff) | |
| download | validator-ade9820f497d678296530bbf13bb4de46253d0fe.tar.bz2 | |
Struct level validation
Diffstat (limited to 'validator_derive/tests/run-pass')
| -rw-r--r-- | validator_derive/tests/run-pass/custom.rs | 2 | ||||
| -rw-r--r-- | validator_derive/tests/run-pass/email.rs | 2 | ||||
| -rw-r--r-- | validator_derive/tests/run-pass/length.rs | 2 | ||||
| -rw-r--r-- | validator_derive/tests/run-pass/must_match.rs | 2 | ||||
| -rw-r--r-- | validator_derive/tests/run-pass/range.rs | 2 | ||||
| -rw-r--r-- | validator_derive/tests/run-pass/schema.rs | 27 |
6 files changed, 32 insertions, 5 deletions
diff --git a/validator_derive/tests/run-pass/custom.rs b/validator_derive/tests/run-pass/custom.rs index 205198e..642b2d2 100644 --- a/validator_derive/tests/run-pass/custom.rs +++ b/validator_derive/tests/run-pass/custom.rs @@ -1,4 +1,4 @@ -#![feature(proc_macro, attr_literals)] +#![feature(attr_literals)] #[macro_use] extern crate validator_derive; extern crate validator; diff --git a/validator_derive/tests/run-pass/email.rs b/validator_derive/tests/run-pass/email.rs index edfc357..014c7b8 100644 --- a/validator_derive/tests/run-pass/email.rs +++ b/validator_derive/tests/run-pass/email.rs @@ -1,4 +1,4 @@ -#![feature(proc_macro, attr_literals)] +#![feature(attr_literals)] #[macro_use] extern crate validator_derive; extern crate validator; diff --git a/validator_derive/tests/run-pass/length.rs b/validator_derive/tests/run-pass/length.rs index 01b85ea..1e0d30e 100644 --- a/validator_derive/tests/run-pass/length.rs +++ b/validator_derive/tests/run-pass/length.rs @@ -1,4 +1,4 @@ -#![feature(proc_macro, attr_literals)] +#![feature(attr_literals)] #[macro_use] extern crate validator_derive; extern crate validator; diff --git a/validator_derive/tests/run-pass/must_match.rs b/validator_derive/tests/run-pass/must_match.rs index 0d2d917..c79d20d 100644 --- a/validator_derive/tests/run-pass/must_match.rs +++ b/validator_derive/tests/run-pass/must_match.rs @@ -1,4 +1,4 @@ -#![feature(proc_macro, attr_literals)] +#![feature(attr_literals)] #[macro_use] extern crate validator_derive; extern crate validator; diff --git a/validator_derive/tests/run-pass/range.rs b/validator_derive/tests/run-pass/range.rs index 8f3a047..79e3229 100644 --- a/validator_derive/tests/run-pass/range.rs +++ b/validator_derive/tests/run-pass/range.rs @@ -1,4 +1,4 @@ -#![feature(proc_macro, attr_literals)] +#![feature(attr_literals)] #[macro_use] extern crate validator_derive; extern crate validator; diff --git a/validator_derive/tests/run-pass/schema.rs b/validator_derive/tests/run-pass/schema.rs new file mode 100644 index 0000000..788d1e2 --- /dev/null +++ b/validator_derive/tests/run-pass/schema.rs @@ -0,0 +1,27 @@ +#![feature(attr_literals)] + +#[macro_use] extern crate validator_derive; +extern crate validator; +use validator::Validate; + +#[derive(Validate)] +#[validate(schema(function = "hey"))] +struct Test { + s: String, +} + +fn hey(_: &Test) -> Option<(String, String)> { + None +} + +#[derive(Validate)] +#[validate(schema(function = "hey2", skip_on_field_errors = false))] +struct Test2 { + s: String, +} + +fn hey2(_: &Test2) -> Option<(String, String)> { + None +} + +fn main() {} |
