]> source.dussan.org Git - sonar-scanner-cli.git/commitdiff
Fix version comparison to make it work with SNAPSHOT and RC
authorJulien HENRY <julien.henry@sonarsource.com>
Wed, 26 Jun 2013 07:12:47 +0000 (09:12 +0200)
committerJulien HENRY <julien.henry@sonarsource.com>
Wed, 26 Jun 2013 07:12:47 +0000 (09:12 +0200)
sonar-runner-batch/src/main/java/org/sonar/runner/batch/VersionUtils.java
sonar-runner-batch/src/test/java/org/sonar/runner/batch/VersionUtilsTest.java

index e26e918e72b8631e725ac75fdb8bbb7c5e6bafb7..01ba89659fafbaa54742f038e781e63892f191e0 100644 (file)
@@ -37,6 +37,6 @@ class VersionUtils {
   }
 
   private static boolean isVersion(String version, String prefix) {
-    return version.startsWith(prefix + ".") || version.equals(prefix);
+    return version.startsWith(prefix) || version.equals(prefix);
   }
 }
index 3838311b37d0b2357a4629665aad0ec574b13de6..3d02317509643b20c4ba9bf2c359f10d067c452f 100644 (file)
@@ -31,6 +31,7 @@ public class VersionUtilsTest {
     assertThat(VersionUtils.isLessThan37("3.0")).isTrue();
     assertThat(VersionUtils.isLessThan37("3.0.1")).isTrue();
     assertThat(VersionUtils.isLessThan37("3.6")).isTrue();
+    assertThat(VersionUtils.isLessThan37("3.6-SNAPSHOT")).isTrue();
     assertThat(VersionUtils.isLessThan37("3.7")).isFalse();
     assertThat(VersionUtils.isLessThan37("4.0")).isFalse();
   }