Skip to content

Commit

Permalink
Merge pull request #936 from uhafner/line-range
Browse files Browse the repository at this point in the history
Improve coverage for `LineRange` test
  • Loading branch information
uhafner authored Mar 7, 2024
2 parents 7d5b128 + 20b2b4d commit 34dc085
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/test/java/edu/hm/hafner/util/LineRangeTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,23 @@ void shouldFindLinesInsideAndOutsideOfLineRange() {
assertThat(lineRange.contains(1)).isTrue();
assertThat(lineRange.contains(2)).isTrue();
assertThat(lineRange.contains(3)).isFalse();
assertThat(lineRange).hasStart(1).hasEnd(2).hasLines(1, 2).hasToString("[1-2]");
assertThat(lineRange).hasStart(1).hasEnd(2)
.hasLines(1, 2).isNotSingleLine().hasToString("[1-2]");

var wrongOrder = new LineRange(2, 1);
assertThat(wrongOrder.contains(0)).isFalse();
assertThat(wrongOrder.contains(1)).isTrue();
assertThat(wrongOrder.contains(2)).isTrue();
assertThat(wrongOrder.contains(3)).isFalse();
assertThat(wrongOrder).hasStart(1).hasEnd(2).hasLines(1, 2).hasToString("[1-2]");
assertThat(wrongOrder).hasStart(1).hasEnd(2)
.hasLines(1, 2).isNotSingleLine().hasToString("[1-2]");

var point = new LineRange(2);
assertThat(point.contains(1)).isFalse();
assertThat(point.contains(2)).isTrue();
assertThat(point.contains(3)).isFalse();
assertThat(point).hasStart(2).hasEnd(2).hasLines(2).hasToString("[2-2]");
assertThat(point).hasStart(2).hasEnd(2)
.hasLines(2).isSingleLine().hasToString("[2-2]");
}

@Test
Expand Down

0 comments on commit 34dc085

Please sign in to comment.