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:
Dave Borowitz
2013-12-13 14:28:48 -08:00
parent baf96c47f7
commit 4c146e5ef4
2 changed files with 4 additions and 3 deletions

View File

@@ -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 {

View File

@@ -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());
}