Fix tests again.

This commit is contained in:
Richard Dodd
2019-01-10 23:42:28 +00:00
parent 36cb50445f
commit 72765757ef
3 changed files with 4 additions and 5 deletions

View File

@ -369,7 +369,7 @@ impl<'a> Context<'a> {
if (type == 'symbol') { if (type == 'symbol') {
const description = val.description; const description = val.description;
if (description == null) { if (description == null) {
return 'Symbol()'; return 'Symbol';
} else { } else {
return 'Symbol(' + description + ')'; return 'Symbol(' + description + ')';
} }

View File

@ -529,7 +529,6 @@ impl Clone for JsValue {
#[cfg(feature = "std")] #[cfg(feature = "std")]
impl fmt::Debug for JsValue { impl fmt::Debug for JsValue {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
use std::fmt::Write;
write!(f, "JsValue({})", self.as_debug_string()) write!(f, "JsValue({})", self.as_debug_string())
} }
} }

View File

@ -71,7 +71,7 @@ pub fn api_get_false() -> JsValue {
#[wasm_bindgen] #[wasm_bindgen]
pub fn api_test_bool(a: &JsValue, b: &JsValue, c: &JsValue) { pub fn api_test_bool(a: &JsValue, b: &JsValue, c: &JsValue) {
assert_eq!(a.as_bool(), Some(true)); assert_eq!(a.as_bool(), Some(true));
assert_eq!(format!("{:?}", a), "true"); assert_eq!(format!("{:?}", a), "JsValue(true)");
assert_eq!(b.as_bool(), Some(false)); assert_eq!(b.as_bool(), Some(false));
assert_eq!(c.as_bool(), None); assert_eq!(c.as_bool(), None);
} }
@ -80,7 +80,7 @@ pub fn api_test_bool(a: &JsValue, b: &JsValue, c: &JsValue) {
pub fn api_mk_symbol() -> JsValue { pub fn api_mk_symbol() -> JsValue {
let a = JsValue::symbol(None); let a = JsValue::symbol(None);
assert!(a.is_symbol()); assert!(a.is_symbol());
assert_eq!(format!("{:?}", a), "Symbol()"); assert_eq!(format!("{:?}", a), "JsValue(Symbol)");
return a; return a;
} }
@ -100,7 +100,7 @@ pub fn api_assert_symbols(a: &JsValue, b: &JsValue) {
#[wasm_bindgen] #[wasm_bindgen]
pub fn api_acquire_string(a: &JsValue, b: &JsValue) { pub fn api_acquire_string(a: &JsValue, b: &JsValue) {
assert_eq!(a.as_string().unwrap(), "foo"); assert_eq!(a.as_string().unwrap(), "foo");
assert_eq!(format!("{:?}", a), "\"foo\""); assert_eq!(format!("{:?}", a), "JsValue(\"foo\")");
assert_eq!(b.as_string(), None); assert_eq!(b.as_string(), None);
} }