aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/deny_public_fields/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit/deny_public_fields/lib.rs')
-rw-r--r--tests/unit/deny_public_fields/lib.rs33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/unit/deny_public_fields/lib.rs b/tests/unit/deny_public_fields/lib.rs
new file mode 100644
index 00000000000..1fcb1314cf3
--- /dev/null
+++ b/tests/unit/deny_public_fields/lib.rs
@@ -0,0 +1,33 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+/**
+```compile_fail
+#[macro_use] extern crate deny_public_fields;
+
+#[derive(DenyPublicFields)]
+struct Foo {
+ pub v1: i32,
+ v2: i32
+}
+
+fn main() {}
+```
+*/
+pub fn deny_public_fields_failing() {}
+
+/**
+```
+#[macro_use] extern crate deny_public_fields;
+
+#[derive(DenyPublicFields)]
+struct Foo {
+ v1: i32,
+ v2: i32
+}
+
+fn main() {}
+```
+*/
+pub fn deny_public_fields_ok() {}