diff options
| -rw-r--r-- | tests/get.rs | 1 | ||||
| -rw-r--r-- | tests/trybuild/invalid-attribute.rs | 21 | ||||
| -rw-r--r-- | tests/trybuild/invalid-attribute.stderr | 23 |
3 files changed, 45 insertions, 0 deletions
diff --git a/tests/get.rs b/tests/get.rs index 76827ca..efa4198 100644 --- a/tests/get.rs +++ b/tests/get.rs @@ -45,4 +45,5 @@ fn trybuild() { let tests = trybuild::TestCases::new(); tests.compile_fail(testcase!("unit-struct.rs")); tests.compile_fail(testcase!("tuple-struct-without-attribute.rs")); + tests.compile_fail(testcase!("invalid-attribute.rs")); } diff --git a/tests/trybuild/invalid-attribute.rs b/tests/trybuild/invalid-attribute.rs new file mode 100644 index 0000000..01f081e --- /dev/null +++ b/tests/trybuild/invalid-attribute.rs @@ -0,0 +1,21 @@ +use get::Get; + +#[derive(Get)] +pub struct Cat { + #[get()] + name: String, +} + +#[derive(Get)] +pub struct Dog { + #[get] + name: String, +} + +#[derive(Get)] +pub struct Crab { + #[get(invalid_name = "invalid_value")] + name: String, +} + +pub fn main() {} diff --git a/tests/trybuild/invalid-attribute.stderr b/tests/trybuild/invalid-attribute.stderr new file mode 100644 index 0000000..426cc06 --- /dev/null +++ b/tests/trybuild/invalid-attribute.stderr @@ -0,0 +1,23 @@ +error: proc-macro derive panicked + --> tests/trybuild/invalid-attribute.rs:3:10 + | +3 | #[derive(Get)] + | ^^^ + | + = help: message: called `Result::unwrap()` on an `Err` value: "failed to parse attribute" + +error: proc-macro derive panicked + --> tests/trybuild/invalid-attribute.rs:9:10 + | +9 | #[derive(Get)] + | ^^^ + | + = help: message: called `Result::unwrap()` on an `Err` value: "failed to parse attribute" + +error: proc-macro derive panicked + --> tests/trybuild/invalid-attribute.rs:15:10 + | +15 | #[derive(Get)] + | ^^^ + | + = help: message: called `Result::unwrap()` on an `Err` value: "invalid name value list in attribute" |
