1 use wasm_bindgen::prelude::*;
2 use wasm_bindgen_test::*;
3 
4 #[wasm_bindgen(module = "tests/wasm/validate_prt.js")]
5 extern "C" {
js_works()6     fn js_works();
7 }
8 
9 #[wasm_bindgen]
10 pub struct Fruit {
11     name: String,
12 }
13 
14 #[wasm_bindgen]
15 impl Fruit {
name(&self) -> String16     pub fn name(&self) -> String {
17         self.name.clone()
18     }
19 
20     #[wasm_bindgen(constructor)]
new(name: String) -> Self21     pub fn new(name: String) -> Self {
22         Fruit { name }
23     }
24 
rot(self)25     pub fn rot(self) {
26         drop(self);
27     }
28 
29     #[wasm_bindgen(getter)]
prop(self) -> u3230     pub fn prop(self) -> u32 {
31         0
32     }
33 
34     #[wasm_bindgen(setter)]
set_prop(self, _val: u32)35     pub fn set_prop(self, _val: u32) {}
36 }
37 
38 #[wasm_bindgen]
eat(_: Fruit)39 pub fn eat(_: Fruit) {}
40 
41 #[wasm_bindgen_test]
works()42 fn works() {
43     js_works();
44 }
45