Format +1 vote on label as Label+1
This matches the old behavior used in emails. Continue to parse +1 for both Label+1 and bare Label. Change-Id: Ic1cfc9ab15a515b12491975586fda20da41b0f2f
This commit is contained in:
@@ -75,8 +75,6 @@ public class LabelVote {
|
||||
public String format() {
|
||||
if (value == (short) 0) {
|
||||
return '-' + name;
|
||||
} else if (value == (short) 1) {
|
||||
return name;
|
||||
} else if (value < 0) {
|
||||
return name + value;
|
||||
} else {
|
||||
|
||||
@@ -34,6 +34,9 @@ public class LabelVoteTest {
|
||||
l = LabelVote.parse("Code-Review");
|
||||
assertEquals("Code-Review", l.getLabel());
|
||||
assertEquals((short) 1, l.getValue());
|
||||
l = LabelVote.parse("Code-Review+1");
|
||||
assertEquals("Code-Review", l.getLabel());
|
||||
assertEquals((short) 1, l.getValue());
|
||||
l = LabelVote.parse("Code-Review+2");
|
||||
assertEquals("Code-Review", l.getLabel());
|
||||
assertEquals((short) 2, l.getValue());
|
||||
@@ -44,7 +47,7 @@ public class LabelVoteTest {
|
||||
assertEquals("Code-Review-2", LabelVote.parse("Code-Review-2").format());
|
||||
assertEquals("Code-Review-1", LabelVote.parse("Code-Review-1").format());
|
||||
assertEquals("-Code-Review", LabelVote.parse("-Code-Review").format());
|
||||
assertEquals("Code-Review", LabelVote.parse("Code-Review").format());
|
||||
assertEquals("Code-Review+1", LabelVote.parse("Code-Review+1").format());
|
||||
assertEquals("Code-Review+2", LabelVote.parse("Code-Review+2").format());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user