Permalink
Browse files

[JENKINS-15097] Deal with crazy android version strings

  • Loading branch information...
recampbell committed Sep 12, 2012
1 parent bcb3578 commit 8a76be5b8244a6735817916dcb32a0631d853ce8
@@ -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.
@@ -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 {
@@ -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.