test(js) Don't unwrap to false.

This commit is contained in:
Ivan Enderlin 2018-07-06 10:41:32 +02:00
parent c450fbf237
commit d1955c91b7
No known key found for this signature in database
GPG Key ID: 461F31FCE31F4AAD

View File

@ -14,11 +14,14 @@ fn validate() {
use wasm_bindgen::js::WebAssembly;
#[wasm_bindgen]
pub fn validate_wasm(wasm: JsValue) -> bool {
WebAssembly::validate(wasm).unwrap_or(false)
pub fn validate_wasm(wasm: JsValue) -> JsValue {
match WebAssembly::validate(wasm) {
Ok(value) => value.into(),
Err(err) => err
}
}
"#)
.file("test.ts", r#"
.file("test.js", r#"
import * as assert from "assert";
import * as wasm from "./out";