Skip to content

Commit 168f070

Browse files
committed
Add a regression test
1 parent 8aba75d commit 168f070

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

worker/tests/event.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,9 @@ fn event_invalid_signatures() {
33
let t = trybuild::TestCases::new();
44
t.compile_fail("tests/ui/*.rs");
55
}
6+
7+
#[test]
8+
fn event_valid_signatures() {
9+
let t = trybuild::TestCases::new();
10+
t.pass("tests/pass/*.rs");
11+
}

worker/tests/pass/start-handler.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Regression test for https://github.com/cloudflare/workers-rs/issues/973.
2+
// A `#[event(start)]` handler must compile without `wasm-bindgen` as a direct
3+
// dependency. The macro should resolve `wasm_bindgen` through `::worker::`.
4+
// It must also not conflict when `wasm_bindgen` is already in scope, or when
5+
// multiple `#[event(start)]` handlers exist in the same module.
6+
use worker::{event, wasm_bindgen};
7+
8+
#[event(start)]
9+
pub fn setup_hook() {}
10+
11+
#[event(start)]
12+
pub fn another_hook() {}
13+
14+
fn main() {}

0 commit comments

Comments
 (0)