diff options
author | 2024-02-12 19:06:00 -0800 | |
---|---|---|
committer | 2024-02-12 19:06:00 -0800 | |
commit | d1dcca690c673ba36cbb9ed81aa40f507e5d427e (patch) | |
tree | 3ce08baf6058d22534856a1406f512bfa820838d | |
parent | ac45743c20fbdfbc89489af478061d19910761df (diff) | |
download | trakt-ansg191/macro-tests.tar.gz trakt-ansg191/macro-tests.tar.zst trakt-ansg191/macro-tests.zip |
Adds `trakt-macros` testsansg191/macro-tests
-rw-r--r-- | trakt-macros/Cargo.toml | 3 | ||||
-rw-r--r-- | trakt-macros/tests/ui.rs | 5 | ||||
-rw-r--r-- | trakt-macros/tests/ui/request/missing_trakt_attr.rs | 6 | ||||
-rw-r--r-- | trakt-macros/tests/ui/request/missing_trakt_attr.stderr | 7 |
4 files changed, 21 insertions, 0 deletions
diff --git a/trakt-macros/Cargo.toml b/trakt-macros/Cargo.toml index 7ede9ee..cdb498f 100644 --- a/trakt-macros/Cargo.toml +++ b/trakt-macros/Cargo.toml @@ -18,3 +18,6 @@ proc-macro = true proc-macro2 = "1" quote = "1" syn = { version = "2", features = ["full"] } + +[dev-dependencies] +trybuild = "1" diff --git a/trakt-macros/tests/ui.rs b/trakt-macros/tests/ui.rs new file mode 100644 index 0000000..ddce693 --- /dev/null +++ b/trakt-macros/tests/ui.rs @@ -0,0 +1,5 @@ +#[test] +fn request_ui() { + let t = trybuild::TestCases::new(); + t.compile_fail("tests/ui/request/*.rs"); +} diff --git a/trakt-macros/tests/ui/request/missing_trakt_attr.rs b/trakt-macros/tests/ui/request/missing_trakt_attr.rs new file mode 100644 index 0000000..0d3955e --- /dev/null +++ b/trakt-macros/tests/ui/request/missing_trakt_attr.rs @@ -0,0 +1,6 @@ +#[derive(Debug, Clone, trakt_macros::Request)] +pub struct Request { + pub id: String, +} + +fn main() {} diff --git a/trakt-macros/tests/ui/request/missing_trakt_attr.stderr b/trakt-macros/tests/ui/request/missing_trakt_attr.stderr new file mode 100644 index 0000000..e72891c --- /dev/null +++ b/trakt-macros/tests/ui/request/missing_trakt_attr.stderr @@ -0,0 +1,7 @@ +error: missing #[trakt(response = "...")] attribute + --> tests/ui/request/missing_trakt_attr.rs:1:24 + | +1 | #[derive(Debug, Clone, trakt_macros::Request)] + | ^^^^^^^^^^^^^^^^^^^^^ + | + = note: this error originates in the derive macro `trakt_macros::Request` (in Nightly builds, run with -Z macro-backtrace for more info) |