function assertEventuallyBadToken(value, ignoreWhitespace = undefined) {
  /** @suppress {visibility} suppression added to enable type checking */
  const tokenizer =
      new TextFormatSerializer.Tokenizer_(value, ignoreWhitespace);
  while (tokenizer.next()) {
  }
  assertEquals(
      TextFormatSerializer.Tokenizer_.TokenTypes.BAD,
      tokenizer.getCurrent().type);
}
Asserts that the given string value parses to a list of tokens ending in the
BAD token.
@param {string} value The string value to parse.
@param {boolean=} ignoreWhitespace Whether whitespace tokens should be
    skipped by the tokenizer.