testSplitLines() {
    /**
     * @param {!Array<string>} expected
     * @param {string} string
     * @param {boolean=} opt_keepNewlines
     */
    function assertSplitLines(expected, string, opt_keepNewlines) {
      const keepNewlines = opt_keepNewlines || false;
      const lines = newlines.splitLines(string, keepNewlines);
      assertElementsEquals(expected, lines);
    }

    // Test values borrowed from Python's splitlines. http://goo.gl/iwawx
    assertSplitLines(['abc', 'def', '', 'ghi'], 'abc\ndef\n\rghi');
    assertSplitLines(['abc', 'def', '', 'ghi'], 'abc\ndef\n\r\nghi');
    assertSplitLines(['abc', 'def', 'ghi'], 'abc\ndef\r\nghi');
    assertSplitLines(['abc', 'def', 'ghi'], 'abc\ndef\r\nghi\n');
    assertSplitLines(['abc', 'def', 'ghi', ''], 'abc\ndef\r\nghi\n\r');
    assertSplitLines(['', 'abc', 'def', 'ghi', ''], '\nabc\ndef\r\nghi\n\r');
    assertSplitLines(['', 'abc', 'def', 'ghi', ''], '\nabc\ndef\r\nghi\n\r');
    assertSplitLines(
        ['\n', 'abc\n', 'def\r\n', 'ghi\n', '\r'], '\nabc\ndef\r\nghi\n\r',
        true);
    assertSplitLines(['', 'abc', 'def', 'ghi', ''], '\nabc\ndef\r\nghi\n\r');
    assertSplitLines(
        ['\n', 'abc\n', 'def\r\n', 'ghi\n', '\r'], '\nabc\ndef\r\nghi\n\r',
        true);
  }
@fileoverview Unit tests for goog.string.