Skip to content

Commit

Permalink
finally fix stable version bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Vlad Dumitrescu authored and vladdu committed Sep 30, 2019
1 parent edd41b6 commit b69af2c
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 8 deletions.
Expand Up @@ -31,8 +31,6 @@ class RuntimeFinder {
result.add(rt)
}
}
println("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
println(result)
return result
}

Expand All @@ -58,7 +56,8 @@ class RuntimeFinder {
}
} catch (IOException e) {
// ignore, kerl is not available or usable
ErlLogger.warn(e)
ErlLogger.info("kerl not found")
// ErlLogger.warn(e)
}
return result.map[if(split(" ", 2).length >= 2) split(" ", 2).get(1) else null].filterNull
}
Expand Down
Expand Up @@ -252,14 +252,15 @@ public int hashCode() {
}

public boolean isStable() {
if (update_level == null)
if (update_level == null) {
return true;
}
try {
// "rc1" is unstable, but "1" is stable
Integer.parseInt(update_level);
// "-rc1" is unstable, but ".15" is stable
// The first character is a separator
Integer.parseInt(update_level.substring(1));
return true;

} catch (NumberFormatException e) {
} catch (final NumberFormatException e) {
return false;
}
}
Expand Down
Expand Up @@ -203,4 +203,23 @@ public void compare_11c() {
assertThat(test1.isCompatible(test2)).isEqualTo(false);
}

@Test
public void stable_1() {
final RuntimeVersion test1 = RuntimeVersion.Serializer.parse("20.1.1");
assertThat(test1.isStable());
}

@Test
public void stable_2() {
final RuntimeVersion test1 = RuntimeVersion.Serializer.parse("20.1.1-rc1");
assertThat(!test1.isStable());
}

@Test
public void stable_3() {
final RuntimeVersion test1 = RuntimeVersion.Serializer.parse("20.1.1.2");
assertThat(test1.isStable());
}


}

0 comments on commit b69af2c

Please sign in to comment.