From 9254465d6876eff8ee9c6431b41cfb9e92d9a9db Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Fri, 29 May 2020 22:23:12 +0100 Subject: ci: test wasm --- serde_dhall/tests/de.rs | 2 +- serde_dhall/tests/wasm.rs | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 serde_dhall/tests/wasm.rs (limited to 'serde_dhall/tests') diff --git a/serde_dhall/tests/de.rs b/serde_dhall/tests/de.rs index 1932e26..a418563 100644 --- a/serde_dhall/tests/de.rs +++ b/serde_dhall/tests/de.rs @@ -21,7 +21,7 @@ fn test_de_typed() { assert_eq!(parse::("1.0"), 1.0); assert_eq!(parse::(r#""foo""#), "foo".to_owned()); - assert_eq!(parse::>("[] : List Natural"), vec![]); + assert_eq!(parse::>("[] : List Natural"), >::new()); assert_eq!(parse::>("[1, 2]"), vec![1, 2]); assert_eq!(parse::>("None Natural"), None); assert_eq!(parse::>("Some 1"), Some(1)); diff --git a/serde_dhall/tests/wasm.rs b/serde_dhall/tests/wasm.rs new file mode 100644 index 0000000..c719d84 --- /dev/null +++ b/serde_dhall/tests/wasm.rs @@ -0,0 +1,12 @@ +#![cfg(target_arch = "wasm32")] +use wasm_bindgen_test::*; + +use serde_dhall::{from_str, FromDhall, StaticType}; + +#[wasm_bindgen_test] +fn test() { + fn parse(s: &str) -> T { + from_str(s).static_type_annotation().parse().unwrap() + } + assert_eq!(parse::>("[1, 2]"), vec![1, 2]); +} -- cgit v1.2.3