Skip to content

Commit aad3478

Browse files
Vlad Dumitrescuvladdu
authored andcommitted
finally fix stable version bug
1 parent be79417 commit aad3478

File tree

3 files changed

+27
-8
lines changed

3 files changed

+27
-8
lines changed

plugins/org.erlide.runtime/src/org/erlide/runtime/runtimeinfo/RuntimeFinder.xtend

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ class RuntimeFinder {
3131
result.add(rt)
3232
}
3333
}
34-
println("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
35-
println(result)
3634
return result
3735
}
3836

@@ -58,7 +56,8 @@ class RuntimeFinder {
5856
}
5957
} catch (IOException e) {
6058
// ignore, kerl is not available or usable
61-
ErlLogger.warn(e)
59+
ErlLogger.info("kerl not found")
60+
// ErlLogger.warn(e)
6261
}
6362
return result.map[if(split(" ", 2).length >= 2) split(" ", 2).get(1) else null].filterNull
6463
}

plugins/org.erlide.runtime/src/org/erlide/runtime/runtimeinfo/RuntimeVersion.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -252,14 +252,15 @@ public int hashCode() {
252252
}
253253

254254
public boolean isStable() {
255-
if (update_level == null)
255+
if (update_level == null) {
256256
return true;
257+
}
257258
try {
258-
// "rc1" is unstable, but "1" is stable
259-
Integer.parseInt(update_level);
259+
// "-rc1" is unstable, but ".15" is stable
260+
// The first character is a separator
261+
Integer.parseInt(update_level.substring(1));
260262
return true;
261-
262-
} catch (NumberFormatException e) {
263+
} catch (final NumberFormatException e) {
263264
return false;
264265
}
265266
}

tests/org.erlide.runtime.tests/src/org/erlide/runtime/RuntimeVersionTest.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,4 +203,23 @@ public void compare_11c() {
203203
assertThat(test1.isCompatible(test2)).isEqualTo(false);
204204
}
205205

206+
@Test
207+
public void stable_1() {
208+
final RuntimeVersion test1 = RuntimeVersion.Serializer.parse("20.1.1");
209+
assertThat(test1.isStable());
210+
}
211+
212+
@Test
213+
public void stable_2() {
214+
final RuntimeVersion test1 = RuntimeVersion.Serializer.parse("20.1.1-rc1");
215+
assertThat(!test1.isStable());
216+
}
217+
218+
@Test
219+
public void stable_3() {
220+
final RuntimeVersion test1 = RuntimeVersion.Serializer.parse("20.1.1.2");
221+
assertThat(test1.isStable());
222+
}
223+
224+
206225
}

0 commit comments

Comments
 (0)