Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
oscartbeaumont committed Dec 24, 2023
1 parent 1291efd commit 15545c5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
6 changes: 4 additions & 2 deletions tests/macro/compile_error.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! This file is run with the `trybuild` crate to assert compilation errors in the Specta macros.

use specta::Type;
use specta::{specta, Type};

// Invalid inflection
#[derive(Type)]
Expand Down Expand Up @@ -103,7 +103,9 @@ pub struct InvalidSpectaAttribute1;
#[specta = "todo"]
pub struct InvalidSpectaAttribute2;

#[wasm_bindgen::prelude::wasm_bindgen]
use wasm_bindgen::prelude::wasm_bindgen;

#[wasm_bindgen]
#[specta]
pub fn testing() {}

Expand Down
14 changes: 11 additions & 3 deletions tests/macro/compile_error.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,19 @@ error: specta: invalid formatted attribute
103 | #[specta = "todo"]
| ^^^^^^

error: specta: You must apply the #[specta] macro before the #[wasm_bindgen] macro
--> tests/macro/compile_error.rs:108:1
|
108 | #[wasm_bindgen]
| ^^^^^^^^^^^^^^^
|
= note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0601]: `main` function not found in crate `$CRATE`
--> tests/macro/compile_error.rs:104:36
--> tests/macro/compile_error.rs:110:20
|
104 | pub struct InvalidSpectaAttribute2;
| ^ consider adding a `main` function to `$DIR/tests/macro/compile_error.rs`
110 | pub fn testing() {}
| ^ consider adding a `main` function to `$DIR/tests/macro/compile_error.rs`

error[E0277]: the trait bound `UnitExternal: specta::Flatten` is not satisfied
--> tests/macro/compile_error.rs:32:11
Expand Down

0 comments on commit 15545c5

Please sign in to comment.