aboutsummaryrefslogtreecommitdiffstats
path: root/validator_derive/tests/run-pass/custom.rs
diff options
context:
space:
mode:
Diffstat (limited to 'validator_derive/tests/run-pass/custom.rs')
-rw-r--r--validator_derive/tests/run-pass/custom.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/validator_derive/tests/run-pass/custom.rs b/validator_derive/tests/run-pass/custom.rs
new file mode 100644
index 0000000..205198e
--- /dev/null
+++ b/validator_derive/tests/run-pass/custom.rs
@@ -0,0 +1,17 @@
+#![feature(proc_macro, attr_literals)]
+
+#[macro_use] extern crate validator_derive;
+extern crate validator;
+use validator::Validate;
+
+#[derive(Validate)]
+struct Test {
+ #[validate(custom = "validate_something")]
+ s: String,
+}
+
+fn validate_something(s: &str) -> Option<String> {
+ Some(s.to_string())
+}
+
+fn main() {}