Permalink
Browse files

Merge pull request #15 from recampbell/master

[JENKINS-15097] Deal with crazy android version strings
  • Loading branch information...
orrc committed Sep 13, 2012
2 parents bcb3578 + 8a76be5 commit 446247837b2bb4f72f6395e747b0f40232331a72
@@ -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 4462478

Please sign in to comment.