js-sys: Add extends to JSON

Part of #670
This commit is contained in:
Nick Fitzgerald
2018-09-06 13:32:31 -07:00
parent cda71757d3
commit 5df2347a7a
2 changed files with 18 additions and 2 deletions

View File

@@ -1,4 +1,4 @@
use wasm_bindgen::JsValue;
use wasm_bindgen::prelude::*;
use wasm_bindgen_test::*;
use wasm_bindgen::JsCast;
use js_sys::*;
@@ -82,3 +82,15 @@ fn stringify_error() {
let err_msg: String = From::from(err.message());
assert!(err_msg.contains("rust really rocks"));
}
#[wasm_bindgen_test]
fn json_extends() {
#[wasm_bindgen]
extern {
#[wasm_bindgen(js_name = JSON)]
static json: JSON;
}
assert!(json.is_instance_of::<Object>());
let _: &Object = json.as_ref();
}