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

    try {
      // This regex matches \B, an index between 2 word characters, so the regex
      // index does not advance when matching this.
      /**
       * @suppress {visibility,const} suppression added to enable type checking
       */
      HtmlPrettyPrinter.TOKEN_REGEX_ =
          /(?:\B|<!--.*?-->|<!.*?>|<(\/?)(\w+)[^>]*>|[^<]+|<)/g;

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

      // But not this one.
      const ex = assertThrows(
          'should have failed for invalid regex - endless loop',
          goog.partial(HtmlPrettyPrinter.format, COMPLEX_HTML));
      assertEquals(
          'Regex failed to make progress through source 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 index
advances after every match. We should never hit this, but we include it on
the chance there is some corner case where the pattern would match but not
process a new token. 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.