Skip to content

Commit

Permalink
Add additional test of existing behavior of Splitter.limit(n)
Browse files Browse the repository at this point in the history
RELNOTES=n/a

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=222407796
  • Loading branch information
nick-someone authored and cgdecker committed Nov 26, 2018
1 parent 1a6c668 commit 9c9c3f3
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,12 @@ public void testLimitFixedLength() {
assertThat(letters).containsExactly("a", "bcd").inOrder();
}

public void testLimit1Separator() {
String simple = "a,b,c,d";
Iterable<String> items = COMMA_SPLITTER.limit(1).split(simple);
assertThat(items).containsExactly("a,b,c,d").inOrder();
}

public void testLimitSeparator() {
String simple = "a,b,c,d";
Iterable<String> items = COMMA_SPLITTER.limit(2).split(simple);
Expand Down
5 changes: 5 additions & 0 deletions guava-gwt/test/com/google/common/base/SplitterTest_gwt.java
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,11 @@ public void testInvalidZeroLimit() throws Exception {
testCase.testInvalidZeroLimit();
}

public void testLimit1Separator() throws Exception {
com.google.common.base.SplitterTest testCase = new com.google.common.base.SplitterTest();
testCase.testLimit1Separator();
}

public void testLimitExtraSeparators() throws Exception {
com.google.common.base.SplitterTest testCase = new com.google.common.base.SplitterTest();
testCase.testLimitExtraSeparators();
Expand Down
6 changes: 6 additions & 0 deletions guava-tests/test/com/google/common/base/SplitterTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,12 @@ public void testLimitFixedLength() {
assertThat(letters).containsExactly("a", "bcd").inOrder();
}

public void testLimit1Separator() {
String simple = "a,b,c,d";
Iterable<String> items = COMMA_SPLITTER.limit(1).split(simple);
assertThat(items).containsExactly("a,b,c,d").inOrder();
}

public void testLimitSeparator() {
String simple = "a,b,c,d";
Iterable<String> items = COMMA_SPLITTER.limit(2).split(simple);
Expand Down

0 comments on commit 9c9c3f3

Please sign in to comment.