blob: f852b8d81458434993e156a29d0ca374a329f608 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
use wasm_bindgen::prelude::*;
use wasm_bindgen_test::*;
#[wasm_bindgen(module = "tests/wasm/char.js")]
extern "C" {
fn js_identity(c: char) -> char;
fn js_works();
}
#[wasm_bindgen]
pub fn rust_identity(c: char) -> char {
c
}
#[wasm_bindgen]
pub fn rust_js_identity(c: char) -> char {
js_identity(c)
}
#[wasm_bindgen]
pub fn letter() -> char {
'a'
}
#[wasm_bindgen]
pub fn face() -> char {
'😀'
}
#[wasm_bindgen]
pub fn rust_letter(a: char) {
assert_eq!(a, 'a');
}
#[wasm_bindgen]
pub fn rust_face(p: char) {
assert_eq!(p, '😀');
}
#[wasm_bindgen_test]
fn works() {
js_works();
}
|