Reject (robot) comments with ranges referring to line 0

Line numbers are 1-based except when they are used to indicate a file
comment. To highlight that behavior, comments are added to the REST
documentation as well as to the code. Those comments additionally
indicate whether the values are inclusive or exclusive.

Change-Id: I4b4409ac25acd2124b3e74cb2ee075206ebae0eb
This commit is contained in:
Alice Kober-Sotzek
2017-03-21 15:19:45 +01:00
parent 73f7323839
commit cd06fb6ddf
4 changed files with 39 additions and 15 deletions

View File

@@ -62,6 +62,30 @@ public class RangeTest {
assertThat(range).isInvalid();
}
@Test
public void zeroStartLineResultsInInvalidRange() {
Comment.Range range = createRange(0, 2, 19, 10);
assertThat(range).isInvalid();
}
@Test
public void zeroEndLineResultsInInvalidRange() {
Comment.Range range = createRange(13, 2, 0, 10);
assertThat(range).isInvalid();
}
@Test
public void zeroStartCharacterResultsInValidRange() {
Comment.Range range = createRange(13, 0, 19, 10);
assertThat(range).isValid();
}
@Test
public void zeroEndCharacterResultsInValidRange() {
Comment.Range range = createRange(13, 31, 19, 0);
assertThat(range).isValid();
}
@Test
public void startLineGreaterThanEndLineResultsInInvalidRange() {
Comment.Range range = createRange(20, 2, 19, 10);