.cargo/vendor/wasm-bindgen/tests/headless/strings.rs
raw| 1 | use wasm_bindgen::prelude::*; |
| 2 | use wasm_bindgen_test::*; |
| 3 | |
| 4 | #[wasm_bindgen(module = "/tests/headless/strings.js")] |
| 5 | extern "C" { |
| 6 | fn test_string_roundtrip(c: &Closure<dyn Fn(String) -> String>); |
| 7 | |
| 8 | fn identity(s: &str) -> String; |
| 9 | } |
| 10 | |
| 11 | #[wasm_bindgen_test] |
| 12 | fn string_roundtrip() { |
| 13 | test_string_roundtrip(&Closure::wrap(Box::new(|s| s))); |
| 14 | |
| 15 | assert_eq!("\u{feff}bar", &identity("\u{feff}bar")); |
| 16 | } |