function assertTokens(value, tokens, ignoreWhitespace = undefined) {
  /** @suppress {visibility} suppression added to enable type checking */
  const tokenizer =
      new TextFormatSerializer.Tokenizer_(value, ignoreWhitespace);
  const tokensFound = [];

  while (tokenizer.next()) {
    tokensFound.push(tokenizer.getCurrent());
  }
  assertEquals(
      TextFormatSerializer.Tokenizer_.TokenTypes.END,
      tokenizer.getCurrent().type);

  if (!Array.isArray(tokens)) {
    tokens = [tokens];
  }

  assertEquals(tokens.length, tokensFound.length);
  for (let i = 0; i < tokens.length; ++i) {
    assertToken(tokens[i], tokensFound[i]);
  }
}
Asserts that the given string value parses into the given set of tokens.
@param {string} value The string value to parse.
@param {Array<Object> | Object} tokens The tokens to check against. If not an
    array, a single token is expected.
@param {boolean=} ignoreWhitespace Whether whitespace tokens should be
    skipped by the tokenizer.