summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJohn Turner <jturner.usa@gmail.com>2023-04-17 00:59:36 -0400
committerJohn Turner <jturner.usa@gmail.com>2023-04-17 00:59:36 -0400
commit2c0ae15fbe603b1deda2ec12306a0dadb5e6f5a3 (patch)
tree85225900587c92fff72e982462f9ed3a0cdfda49 /tests
parentee3cba7204199cc0e6193be3bb40e9814dd4cfb9 (diff)
downloadget-2c0ae15fbe603b1deda2ec12306a0dadb5e6f5a3.tar.gz
added test case unit-struct.rs
Diffstat (limited to 'tests')
-rw-r--r--tests/get.rs6
-rw-r--r--tests/trybuild/unit-struct.rs6
-rw-r--r--tests/trybuild/unit-struct.stderr7
3 files changed, 19 insertions, 0 deletions
diff --git a/tests/get.rs b/tests/get.rs
index 4019cd5..8a61a69 100644
--- a/tests/get.rs
+++ b/tests/get.rs
@@ -39,3 +39,9 @@ fn cat_tuple_struct() {
assert_eq!(*cat.age(), 1);
assert!(matches!(cat.owner(), ()));
}
+
+#[test]
+fn trybuild() {
+ let tests = trybuild::TestCases::new();
+ tests.compile_fail(testcase!("unit-struct.rs"));
+}
diff --git a/tests/trybuild/unit-struct.rs b/tests/trybuild/unit-struct.rs
new file mode 100644
index 0000000..5a3ed0c
--- /dev/null
+++ b/tests/trybuild/unit-struct.rs
@@ -0,0 +1,6 @@
+use get::Get;
+
+#[derive(Get)]
+struct Cat;
+
+pub fn main() {}
diff --git a/tests/trybuild/unit-struct.stderr b/tests/trybuild/unit-struct.stderr
new file mode 100644
index 0000000..41da09f
--- /dev/null
+++ b/tests/trybuild/unit-struct.stderr
@@ -0,0 +1,7 @@
+error: proc-macro derive panicked
+ --> tests/trybuild/unit-struct.rs:3:10
+ |
+3 | #[derive(Get)]
+ | ^^^
+ |
+ = help: message: called `Result::unwrap()` on an `Err` value: "can not generate getters on a unit struct"