Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[JENKINS-15097] Deal with crazy android version strings
  • Loading branch information
recampbell committed Sep 12, 2012
1 parent bcb3578 commit 8a76be5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
Expand Up @@ -46,7 +46,7 @@

public class Utils {

private static final Pattern REVISION = Pattern.compile("(\\d+)(?:\\.\\d+){0,2}");
private static final Pattern REVISION = Pattern.compile("(\\d++).*");

/**
* Retrieves the configured Android SDK root directory.
Expand Down
Expand Up @@ -7,6 +7,10 @@ public void testParseRevisionString() throws Exception {
assertEquals(20, Utils.parseRevisionString("20.0.1"));
assertEquals(20, Utils.parseRevisionString("20.0"));
assertEquals(20, Utils.parseRevisionString("20"));
assertEquals(20, Utils.parseRevisionString("20.foo"));
assertEquals(21, Utils.parseRevisionString("21 rc4"));
assertEquals(21, Utils.parseRevisionString("21 rc3"));

}

public void testParseRevisionStringFailureCase() throws Exception {
Expand All @@ -15,11 +19,5 @@ public void testParseRevisionStringFailureCase() throws Exception {
fail("expected exception");
} catch (NumberFormatException e) {
}

try {
Utils.parseRevisionString("20.foo");
fail("expected exception");
} catch (NumberFormatException e) {
}
}
}

0 comments on commit 8a76be5

Please sign in to comment.