Browse Source

Toggleable `JsValue` internals displaying (#1865)

This PR makes `JsValue` (object) only display owned properties, cleans up object printing. This can be toggled with `value.display().internals(true)`

`>> ({x: 1, y: ""})`
_Before:_
<details>
<pre>
{
   x: 1,
   y: "",
__proto__: {
hasOwnProperty: {
      length: 1,
        name: "hasOwnProperty",
   __proto__: {
            name: "",
          length: 0,
           apply: {
              length: 1,
                name: "apply",
           __proto__: [Cycle]
                },
            bind: {
              length: 1,
                name: "bind",
           __proto__: [Cycle]
                },
            call: {
              length: 1,
                name: "call",
           __proto__: [Cycle]
                },
        toString: {
              length: 0,
                name: "toString",
           __proto__: [Cycle]
                },
     constructor: {
              length: 1,
                name: "Function",
           prototype: [Cycle],
           __proto__: [Cycle]
                },
Symbol(Symbol.hasInstance): {
              length: 1,
                name: "[Symbol.iterator]",
           __proto__: [Cycle]
                },
       __proto__: [Cycle]
            }
        },
propertyIsEnumerable: {
      length: 1,
        name: "propertyIsEnumerable",
   __proto__: {
            name: "",
          length: 0,
           apply: {
              length: 1,
                name: "apply",
           __proto__: [Cycle]
                },
            bind: {
              length: 1,
                name: "bind",
           __proto__: [Cycle]
                },
            call: {
              length: 1,
                name: "call",
           __proto__: [Cycle]
                },
        toString: {
              length: 0,
                name: "toString",
           __proto__: [Cycle]
                },
     constructor: {
              length: 1,
                name: "Function",
           prototype: [Cycle],
           __proto__: [Cycle]
                },
Symbol(Symbol.hasInstance): {
              length: 1,
                name: "[Symbol.iterator]",
           __proto__: [Cycle]
                },
       __proto__: [Cycle]
            }
        },
toString: {
      length: 0,
        name: "toString",
   __proto__: {
            name: "",
          length: 0,
           apply: {
              length: 1,
                name: "apply",
           __proto__: [Cycle]
                },
            bind: {
              length: 1,
                name: "bind",
           __proto__: [Cycle]
                },
            call: {
              length: 1,
                name: "call",
           __proto__: [Cycle]
                },
        toString: {
              length: 0,
                name: "toString",
           __proto__: [Cycle]
                },
     constructor: {
              length: 1,
                name: "Function",
           prototype: [Cycle],
           __proto__: [Cycle]
                },
Symbol(Symbol.hasInstance): {
              length: 1,
                name: "[Symbol.iterator]",
           __proto__: [Cycle]
                },
       __proto__: [Cycle]
            }
        },
 valueOf: {
      length: 0,
        name: "valueOf",
   __proto__: {
            name: "",
          length: 0,
           apply: {
              length: 1,
                name: "apply",
           __proto__: [Cycle]
                },
            bind: {
              length: 1,
                name: "bind",
           __proto__: [Cycle]
                },
            call: {
              length: 1,
                name: "call",
           __proto__: [Cycle]
                },
        toString: {
              length: 0,
                name: "toString",
           __proto__: [Cycle]
                },
     constructor: {
              length: 1,
                name: "Function",
           prototype: [Cycle],
           __proto__: [Cycle]
                },
Symbol(Symbol.hasInstance): {
              length: 1,
                name: "[Symbol.iterator]",
           __proto__: [Cycle]
                },
       __proto__: [Cycle]
            }
        },
isPrototypeOf: {
      length: 1,
        name: "isPrototypeOf",
   __proto__: {
            name: "",
          length: 0,
           apply: {
              length: 1,
                name: "apply",
           __proto__: [Cycle]
                },
            bind: {
              length: 1,
                name: "bind",
           __proto__: [Cycle]
                },
            call: {
              length: 1,
                name: "call",
           __proto__: [Cycle]
                },
        toString: {
              length: 0,
                name: "toString",
           __proto__: [Cycle]
                },
     constructor: {
              length: 1,
                name: "Function",
           prototype: [Cycle],
           __proto__: [Cycle]
                },
Symbol(Symbol.hasInstance): {
              length: 1,
                name: "[Symbol.iterator]",
           __proto__: [Cycle]
                },
       __proto__: [Cycle]
            }
        },
constructor: {
      create: {
          length: 2,
            name: "create",
       __proto__: {
                name: "",
              length: 0,
               apply: {
                  length: 1,
                    name: "apply",
               __proto__: [Cycle]
                    },
                bind: {
                  length: 1,
                    name: "bind",
               __proto__: [Cycle]
                    },
                call: {
                  length: 1,
                    name: "call",
               __proto__: [Cycle]
                    },
            toString: {
                  length: 0,
                    name: "toString",
               __proto__: [Cycle]
                    },
         constructor: {
                  length: 1,
                    name: "Function",
               prototype: [Cycle],
               __proto__: [Cycle]
                    },
Symbol(Symbol.hasInstance): {
                  length: 1,
                    name: "[Symbol.iterator]",
               __proto__: [Cycle]
                    },
           __proto__: [Cycle]
                }
            },
setPrototypeOf: {
          length: 2,
            name: "setPrototypeOf",
       __proto__: {
                name: "",
              length: 0,
               apply: {
                  length: 1,
                    name: "apply",
               __proto__: [Cycle]
                    },
                bind: {
                  length: 1,
                    name: "bind",
               __proto__: [Cycle]
                    },
                call: {
                  length: 1,
                    name: "call",
               __proto__: [Cycle]
                    },
            toString: {
                  length: 0,
                    name: "toString",
               __proto__: [Cycle]
                    },
         constructor: {
                  length: 1,
                    name: "Function",
               prototype: [Cycle],
               __proto__: [Cycle]
                    },
Symbol(Symbol.hasInstance): {
                  length: 1,
                    name: "[Symbol.iterator]",
               __proto__: [Cycle]
                    },
           __proto__: [Cycle]
                }
            },
getPrototypeOf: {
          length: 1,
            name: "getPrototypeOf",
       __proto__: {
                name: "",
              length: 0,
               apply: {
                  length: 1,
                    name: "apply",
               __proto__: [Cycle]
                    },
                bind: {
                  length: 1,
                    name: "bind",
               __proto__: [Cycle]
                    },
                call: {
                  length: 1,
                    name: "call",
               __proto__: [Cycle]
                    },
            toString: {
                  length: 0,
                    name: "toString",
               __proto__: [Cycle]
                    },
         constructor: {
                  length: 1,
                    name: "Function",
               prototype: [Cycle],
               __proto__: [Cycle]
                    },
Symbol(Symbol.hasInstance): {
                  length: 1,
                    name: "[Symbol.iterator]",
               __proto__: [Cycle]
                    },
           __proto__: [Cycle]
                }
            },
defineProperty: {
          length: 3,
            name: "defineProperty",
       __proto__: {
                name: "",
              length: 0,
               apply: {
                  length: 1,
                    name: "apply",
               __proto__: [Cycle]
                    },
                bind: {
                  length: 1,
                    name: "bind",
               __proto__: [Cycle]
                    },
                call: {
                  length: 1,
                    name: "call",
               __proto__: [Cycle]
                    },
            toString: {
                  length: 0,
                    name: "toString",
               __proto__: [Cycle]
                    },
         constructor: {
                  length: 1,
                    name: "Function",
               prototype: [Cycle],
               __proto__: [Cycle]
                    },
Symbol(Symbol.hasInstance): {
                  length: 1,
                    name: "[Symbol.iterator]",
               __proto__: [Cycle]
                    },
           __proto__: [Cycle]
                }
            },
defineProperties: {
          length: 2,
            name: "defineProperties",
       __proto__: {
                name: "",
              length: 0,
               apply: {
                  length: 1,
                    name: "apply",
               __proto__: [Cycle]
                    },
                bind: {
                  length: 1,
                    name: "bind",
               __proto__: [Cycle]
                    },
                call: {
                  length: 1,
                    name: "call",
               __proto__: [Cycle]
                    },
            toString: {
                  length: 0,
                    name: "toString",
               __proto__: [Cycle]
                    },
         constructor: {
                  length: 1,
                    name: "Function",
               prototype: [Cycle],
               __proto__: [Cycle]
                    },
Symbol(Symbol.hasInstance): {
                  length: 1,
                    name: "[Symbol.iterator]",
               __proto__: [Cycle]
                    },
           __proto__: [Cycle]
                }
            },
      assign: {
          length: 2,
            name: "assign",
       __proto__: {
                name: "",
              length: 0,
               apply: {
                  length: 1,
                    name: "apply",
               __proto__: [Cycle]
                    },
                bind: {
                  length: 1,
                    name: "bind",
               __proto__: [Cycle]
                    },
                call: {
                  length: 1,
                    name: "call",
               __proto__: [Cycle]
                    },
            toString: {
                  length: 0,
                    name: "toString",
               __proto__: [Cycle]
                    },
         constructor: {
                  length: 1,
                    name: "Function",
               prototype: [Cycle],
               __proto__: [Cycle]
                    },
Symbol(Symbol.hasInstance): {
                  length: 1,
                    name: "[Symbol.iterator]",
               __proto__: [Cycle]
                    },
           __proto__: [Cycle]
                }
            },
          is: {
          length: 2,
            name: "is",
       __proto__: {
                name: "",
              length: 0,
               apply: {
                  length: 1,
                    name: "apply",
               __proto__: [Cycle]
                    },
                bind: {
                  length: 1,
                    name: "bind",
               __proto__: [Cycle]
                    },
                call: {
                  length: 1,
                    name: "call",
               __proto__: [Cycle]
                    },
            toString: {
                  length: 0,
                    name: "toString",
               __proto__: [Cycle]
                    },
         constructor: {
                  length: 1,
                    name: "Function",
               prototype: [Cycle],
               __proto__: [Cycle]
                    },
Symbol(Symbol.hasInstance): {
                  length: 1,
                    name: "[Symbol.iterator]",
               __proto__: [Cycle]
                    },
           __proto__: [Cycle]
                }
            },
        keys: {
          length: 1,
            name: "keys",
       __proto__: {
                name: "",
              length: 0,
               apply: {
                  length: 1,
                    name: "apply",
               __proto__: [Cycle]
                    },
                bind: {
                  length: 1,
                    name: "bind",
               __proto__: [Cycle]
                    },
                call: {
                  length: 1,
                    name: "call",
               __proto__: [Cycle]
                    },
            toString: {
                  length: 0,
                    name: "toString",
               __proto__: [Cycle]
                    },
         constructor: {
                  length: 1,
                    name: "Function",
               prototype: [Cycle],
               __proto__: [Cycle]
                    },
Symbol(Symbol.hasInstance): {
                  length: 1,
                    name: "[Symbol.iterator]",
               __proto__: [Cycle]
                    },
           __proto__: [Cycle]
                }
            },
      values: {
          length: 1,
            name: "values",
       __proto__: {
                name: "",
              length: 0,
               apply: {
                  length: 1,
                    name: "apply",
               __proto__: [Cycle]
                    },
                bind: {
                  length: 1,
                    name: "bind",
               __proto__: [Cycle]
                    },
                call: {
                  length: 1,
                    name: "call",
               __proto__: [Cycle]
                    },
            toString: {
                  length: 0,
                    name: "toString",
               __proto__: [Cycle]
                    },
         constructor: {
                  length: 1,
                    name: "Function",
               prototype: [Cycle],
               __proto__: [Cycle]
                    },
Symbol(Symbol.hasInstance): {
                  length: 1,
                    name: "[Symbol.iterator]",
               __proto__: [Cycle]
                    },
           __proto__: [Cycle]
                }
            },
     entries: {
          length: 1,
            name: "entries",
       __proto__: {
                name: "",
              length: 0,
               apply: {
                  length: 1,
                    name: "apply",
               __proto__: [Cycle]
                    },
                bind: {
                  length: 1,
                    name: "bind",
               __proto__: [Cycle]
                    },
                call: {
                  length: 1,
                    name: "call",
               __proto__: [Cycle]
                    },
            toString: {
                  length: 0,
                    name: "toString",
               __proto__: [Cycle]
                    },
         constructor: {
                  length: 1,
                    name: "Function",
               prototype: [Cycle],
               __proto__: [Cycle]
                    },
Symbol(Symbol.hasInstance): {
                  length: 1,
                    name: "[Symbol.iterator]",
               __proto__: [Cycle]
                    },
           __proto__: [Cycle]
                }
            },
        seal: {
          length: 1,
            name: "seal",
       __proto__: {
                name: "",
              length: 0,
               apply: {
                  length: 1,
                    name: "apply",
               __proto__: [Cycle]
                    },
                bind: {
                  length: 1,
                    name: "bind",
               __proto__: [Cycle]
                    },
                call: {
                  length: 1,
                    name: "call",
               __proto__: [Cycle]
                    },
            toString: {
                  length: 0,
                    name: "toString",
               __proto__: [Cycle]
                    },
         constructor: {
                  length: 1,
                    name: "Function",
               prototype: [Cycle],
               __proto__: [Cycle]
                    },
Symbol(Symbol.hasInstance): {
                  length: 1,
                    name: "[Symbol.iterator]",
               __proto__: [Cycle]
                    },
           __proto__: [Cycle]
                }
            },
    isSealed: {
          length: 1,
            name: "isSealed",
       __proto__: {
                name: "",
              length: 0,
               apply: {
                  length: 1,
                    name: "apply",
               __proto__: [Cycle]
                    },
                bind: {
                  length: 1,
                    name: "bind",
               __proto__: [Cycle]
                    },
                call: {
                  length: 1,
                    name: "call",
               __proto__: [Cycle]
                    },
            toString: {
                  length: 0,
                    name: "toString",
               __proto__: [Cycle]
                    },
         constructor: {
                  length: 1,
                    name: "Function",
               prototype: [Cycle],
               __proto__: [Cycle]
                    },
Symbol(Symbol.hasInstance): {
                  length: 1,
                    name: "[Symbol.iterator]",
               __proto__: [Cycle]
                    },
           __proto__: [Cycle]
                }
            },
      freeze: {
          length: 1,
            name: "freeze",
       __proto__: {
                name: "",
              length: 0,
               apply: {
                  length: 1,
                    name: "apply",
               __proto__: [Cycle]
                    },
                bind: {
                  length: 1,
                    name: "bind",
               __proto__: [Cycle]
                    },
                call: {
                  length: 1,
                    name: "call",
               __proto__: [Cycle]
                    },
            toString: {
                  length: 0,
                    name: "toString",
               __proto__: [Cycle]
                    },
         constructor: {
                  length: 1,
                    name: "Function",
               prototype: [Cycle],
               __proto__: [Cycle]
                    },
Symbol(Symbol.hasInstance): {
                  length: 1,
                    name: "[Symbol.iterator]",
               __proto__: [Cycle]
                    },
           __proto__: [Cycle]
                }
            },
    isFrozen: {
          length: 1,
            name: "isFrozen",
       __proto__: {
                name: "",
              length: 0,
               apply: {
                  length: 1,
                    name: "apply",
               __proto__: [Cycle]
                    },
                bind: {
                  length: 1,
                    name: "bind",
               __proto__: [Cycle]
                    },
                call: {
                  length: 1,
                    name: "call",
               __proto__: [Cycle]
                    },
            toString: {
                  length: 0,
                    name: "toString",
               __proto__: [Cycle]
                    },
         constructor: {
                  length: 1,
                    name: "Function",
               prototype: [Cycle],
               __proto__: [Cycle]
                    },
Symbol(Symbol.hasInstance): {
                  length: 1,
                    name: "[Symbol.iterator]",
               __proto__: [Cycle]
                    },
           __proto__: [Cycle]
                }
            },
preventExtensions: {
          length: 1,
            name: "preventExtensions",
       __proto__: {
                name: "",
              length: 0,
               apply: {
                  length: 1,
                    name: "apply",
               __proto__: [Cycle]
                    },
                bind: {
                  length: 1,
                    name: "bind",
               __proto__: [Cycle]
                    },
                call: {
                  length: 1,
                    name: "call",
               __proto__: [Cycle]
                    },
            toString: {
                  length: 0,
                    name: "toString",
               __proto__: [Cycle]
                    },
         constructor: {
                  length: 1,
                    name: "Function",
               prototype: [Cycle],
               __proto__: [Cycle]
                    },
Symbol(Symbol.hasInstance): {
                  length: 1,
                    name: "[Symbol.iterator]",
               __proto__: [Cycle]
                    },
           __proto__: [Cycle]
                }
            },
isExtensible: {
          length: 1,
            name: "isExtensible",
       __proto__: {
                name: "",
              length: 0,
               apply: {
                  length: 1,
                    name: "apply",
               __proto__: [Cycle]
                    },
                bind: {
                  length: 1,
                    name: "bind",
               __proto__: [Cycle]
                    },
                call: {
                  length: 1,
                    name: "call",
               __proto__: [Cycle]
                    },
            toString: {
                  length: 0,
                    name: "toString",
               __proto__: [Cycle]
                    },
         constructor: {
                  length: 1,
                    name: "Function",
               prototype: [Cycle],
               __proto__: [Cycle]
                    },
Symbol(Symbol.hasInstance): {
                  length: 1,
                    name: "[Symbol.iterator]",
               __proto__: [Cycle]
                    },
           __proto__: [Cycle]
                }
            },
getOwnPropertyDescriptor: {
          length: 2,
            name: "getOwnPropertyDescriptor",
       __proto__: {
                name: "",
              length: 0,
               apply: {
                  length: 1,
                    name: "apply",
               __proto__: [Cycle]
                    },
                bind: {
                  length: 1,
                    name: "bind",
               __proto__: [Cycle]
                    },
                call: {
                  length: 1,
                    name: "call",
               __proto__: [Cycle]
                    },
            toString: {
                  length: 0,
                    name: "toString",
               __proto__: [Cycle]
                    },
         constructor: {
                  length: 1,
                    name: "Function",
               prototype: [Cycle],
               __proto__: [Cycle]
                    },
Symbol(Symbol.hasInstance): {
                  length: 1,
                    name: "[Symbol.iterator]",
               __proto__: [Cycle]
                    },
           __proto__: [Cycle]
                }
            },
getOwnPropertyDescriptors: {
          length: 1,
            name: "getOwnPropertyDescriptors",
       __proto__: {
                name: "",
              length: 0,
               apply: {
                  length: 1,
                    name: "apply",
               __proto__: [Cycle]
                    },
                bind: {
                  length: 1,
                    name: "bind",
               __proto__: [Cycle]
                    },
                call: {
                  length: 1,
                    name: "call",
               __proto__: [Cycle]
                    },
            toString: {
                  length: 0,
                    name: "toString",
               __proto__: [Cycle]
                    },
         constructor: {
                  length: 1,
                    name: "Function",
               prototype: [Cycle],
               __proto__: [Cycle]
                    },
Symbol(Symbol.hasInstance): {
                  length: 1,
                    name: "[Symbol.iterator]",
               __proto__: [Cycle]
                    },
           __proto__: [Cycle]
                }
            },
getOwnPropertyNames: {
          length: 1,
            name: "getOwnPropertyNames",
       __proto__: {
                name: "",
              length: 0,
               apply: {
                  length: 1,
                    name: "apply",
               __proto__: [Cycle]
                    },
                bind: {
                  length: 1,
                    name: "bind",
               __proto__: [Cycle]
                    },
                call: {
                  length: 1,
                    name: "call",
               __proto__: [Cycle]
                    },
            toString: {
                  length: 0,
                    name: "toString",
               __proto__: [Cycle]
                    },
         constructor: {
                  length: 1,
                    name: "Function",
               prototype: [Cycle],
               __proto__: [Cycle]
                    },
Symbol(Symbol.hasInstance): {
                  length: 1,
                    name: "[Symbol.iterator]",
               __proto__: [Cycle]
                    },
           __proto__: [Cycle]
                }
            },
getOwnPropertySymbols: {
          length: 1,
            name: "getOwnPropertySymbols",
       __proto__: {
                name: "",
              length: 0,
               apply: {
                  length: 1,
                    name: "apply",
               __proto__: [Cycle]
                    },
                bind: {
                  length: 1,
                    name: "bind",
               __proto__: [Cycle]
                    },
                call: {
                  length: 1,
                    name: "call",
               __proto__: [Cycle]
                    },
            toString: {
                  length: 0,
                    name: "toString",
               __proto__: [Cycle]
                    },
         constructor: {
                  length: 1,
                    name: "Function",
               prototype: [Cycle],
               __proto__: [Cycle]
                    },
Symbol(Symbol.hasInstance): {
                  length: 1,
                    name: "[Symbol.iterator]",
               __proto__: [Cycle]
                    },
           __proto__: [Cycle]
                }
            },
      hasOwn: {
          length: 2,
            name: "hasOwn",
       __proto__: {
                name: "",
              length: 0,
               apply: {
                  length: 1,
                    name: "apply",
               __proto__: [Cycle]
                    },
                bind: {
                  length: 1,
                    name: "bind",
               __proto__: [Cycle]
                    },
                call: {
                  length: 1,
                    name: "call",
               __proto__: [Cycle]
                    },
            toString: {
                  length: 0,
                    name: "toString",
               __proto__: [Cycle]
                    },
         constructor: {
                  length: 1,
                    name: "Function",
               prototype: [Cycle],
               __proto__: [Cycle]
                    },
Symbol(Symbol.hasInstance): {
                  length: 1,
                    name: "[Symbol.iterator]",
               __proto__: [Cycle]
                    },
           __proto__: [Cycle]
                }
            },
 fromEntries: {
          length: 1,
            name: "fromEntries",
       __proto__: {
                name: "",
              length: 0,
               apply: {
                  length: 1,
                    name: "apply",
               __proto__: [Cycle]
                    },
                bind: {
                  length: 1,
                    name: "bind",
               __proto__: [Cycle]
                    },
                call: {
                  length: 1,
                    name: "call",
               __proto__: [Cycle]
                    },
            toString: {
                  length: 0,
                    name: "toString",
               __proto__: [Cycle]
                    },
         constructor: {
                  length: 1,
                    name: "Function",
               prototype: [Cycle],
               __proto__: [Cycle]
                    },
Symbol(Symbol.hasInstance): {
                  length: 1,
                    name: "[Symbol.iterator]",
               __proto__: [Cycle]
                    },
           __proto__: [Cycle]
                }
            },
      length: 1,
        name: "Object",
   prototype: [Cycle],
   __proto__: {
            name: "",
          length: 0,
           apply: {
              length: 1,
                name: "apply",
           __proto__: [Cycle]
                },
            bind: {
              length: 1,
                name: "bind",
           __proto__: [Cycle]
                },
            call: {
              length: 1,
                name: "call",
           __proto__: [Cycle]
                },
        toString: {
              length: 0,
                name: "toString",
           __proto__: [Cycle]
                },
     constructor: {
              length: 1,
                name: "Function",
           prototype: [Cycle],
           __proto__: [Cycle]
                },
Symbol(Symbol.hasInstance): {
              length: 1,
                name: "[Symbol.iterator]",
           __proto__: [Cycle]
                },
       __proto__: [Cycle]
            }
        },
__proto__: null
    }
}
</pre>
</details>

_After:_
```text
{
   x: 1,
   y: ""
}
```
pull/1854/head
Halid Odat 3 years ago
parent
commit
9dda8d3eae
  1. 16
      boa_engine/src/value/display.rs
  2. 8
      boa_engine/src/value/mod.rs
  3. 7
      boa_tester/src/exec/mod.rs

16
boa_engine/src/value/display.rs

@ -6,6 +6,18 @@ use super::{fmt, Display, HashSet, JsValue, PropertyKey};
#[derive(Debug, Clone, Copy)]
pub struct ValueDisplay<'value> {
pub(super) value: &'value JsValue,
pub(super) internals: bool,
}
impl ValueDisplay<'_> {
/// Display internal information about value.
///
/// By default this is `false`.
#[inline]
pub fn internals(mut self, yes: bool) -> Self {
self.internals = yes;
self
}
}
/// A helper macro for printing objects
@ -275,7 +287,9 @@ impl Display for ValueDisplay<'_> {
},
JsValue::String(ref v) => write!(f, "\"{v}\""),
JsValue::Rational(v) => format_rational(*v, f),
JsValue::Object(_) => write!(f, "{}", log_string_from(self.value, true, true)),
JsValue::Object(_) => {
write!(f, "{}", log_string_from(self.value, self.internals, true))
}
JsValue::Integer(v) => write!(f, "{v}"),
JsValue::BigInt(ref num) => write!(f, "{num}n"),
}

8
boa_engine/src/value/mod.rs

@ -494,6 +494,9 @@ impl JsValue {
/// Returns an object that implements `Display`.
///
/// By default the internals are not shown, but they can be toggled
/// with [`ValueDisplay::internals`] method.
///
/// # Examples
///
/// ```
@ -505,7 +508,10 @@ impl JsValue {
/// ```
#[inline]
pub fn display(&self) -> ValueDisplay<'_> {
ValueDisplay { value: self }
ValueDisplay {
value: self,
internals: false,
}
}
/// Converts the value to a string.

7
boa_tester/src/exec/mod.rs

@ -206,8 +206,11 @@ impl Test {
match context.eval(&self.content.as_ref()) {
Ok(res) => (false, res.display().to_string()),
Err(e) => {
let passed =
e.display().to_string().contains(error_type.as_ref());
let passed = e
.display()
.internals(true)
.to_string()
.contains(error_type.as_ref());
(passed, format!("Uncaught {}", e.display()))
}

Loading…
Cancel
Save