testAvoidDataLoss() {
    /** @suppress {visibility} suppression added to enable type checking */
    const original = HtmlPrettyPrinter.TOKEN_REGEX_;

    try {
      // This regex does not match stranded '<' characters, so does not fully
      // tokenize the string.
      /**
       * @suppress {visibility,constantProperty} suppression added to enable
       * type checking
       */
      HtmlPrettyPrinter.TOKEN_REGEX_ =
          /(?:<!--.*?-->|<!.*?>|<(\/?)(\w+)[^>]*>|[^<]+)/g;

      // It would work on this string.
      assertEquals('foo\n', HtmlPrettyPrinter.format('foo'));

      // But not this one.
      const ex = assertThrows(
          'should have failed for invalid regex - data loss',
          goog.partial(HtmlPrettyPrinter.format, COMPLEX_HTML));
      assertEquals('Lost data pretty printing html.', ex.message);
    } finally {
      /**
       * @suppress {visibility,constantProperty} suppression added to enable
       * type checking
       */
      HtmlPrettyPrinter.TOKEN_REGEX_ = original;
    }
  }
We have a sanity check in HtmlPrettyPrinter to make sure the regex fully
tokenizes the string. We should never hit this, but we include it on the
chance there is some corner case where the pattern would miss a section of
original string. It's not generally a good idea to break the
implementation to test behavior, but this is the easiest way to mimic a
bad internal state.