@Test
public void testAnalyzeIndentations() {

  assertEquals(tokenList(), analyze());
  assertEquals(tokenList("foo"), analyze("foo"));
  assertEquals(tokenList("foo", "bar"), analyze("foo", "bar"));
  assertEquals(tokenList("foo", 1, "bar"), analyze("foo", "\n", "bar"));
  assertEquals(tokenList("foo", 4, "bar"), analyze("foo", "\n", 2, "\n", "bar"));
  assertEquals(tokenList("foo", 2, Indentation.Punctuation.INDENT, "bar", 1, Indentation.Punctuation.OUTDENT, 1, "baz"),
      analyze("foo", "\n", 1, "bar", "\n", "\n", "baz"));
  assertEquals(tokenList(2, "foo", "bar"), analyze(2, "foo", "bar"));
  assertEquals(tokenList(2, "foo", 2, "bar"), analyze(2, "foo", "\n", 1, "bar"));
  assertEquals(tokenList("foo", 2, Indentation.Punctuation.INDENT, "bar", Indentation.Punctuation.OUTDENT),
      analyze("foo", "\n", 1, "bar"));
  assertEquals(tokenList("foo", 2, Indentation.Punctuation.INDENT, "bar", 1, Indentation.Punctuation.OUTDENT, 2, Indentation.Punctuation.INDENT, "baz", Indentation.Punctuation.OUTDENT),
      analyze("foo", "\n", 1, "bar", "\n", "\n", 1, "baz"));
  assertEquals(tokenList("foo", 2, Indentation.Punctuation.INDENT, "bar", 2, "bar2", 4, Indentation.Punctuation.INDENT, "baz", Indentation.Punctuation.OUTDENT, Indentation.Punctuation.OUTDENT),
      analyze("foo", "\n", 1, "bar", "\n", 1, "bar2", "\n", 3, "baz"));
  assertEquals(tokenList(
      "foo", 2, Indentation.Punctuation.INDENT, "bar", 4, Indentation.Punctuation.INDENT, "baz", 3, Indentation.Punctuation.OUTDENT, Indentation.Punctuation.INDENT, "end", Indentation.Punctuation.OUTDENT, Indentation.Punctuation.OUTDENT),
      analyze("foo", "\n", 1, "bar", "\n", 3, "baz", "\n", 2, "end"));
}