  }`;
    }
    function stringifyEvents(events) {
      let str = "[";
      for (const event of events) {
        if (str != "[") {
          str += ", ";
        }
        str += stringifyEvent(event);
      }
      return str + "]";
    }

    test(() => {
      assert_equals(
        stringifyEvents(mouseEvents),
        stringifyEvents([
          { type: "mouseout",   target: '<div id="div0">', buttons: 1, button: 0 },
          { type: "mouseleave", target: '<div id="div0">', buttons: 1, button: 0 }