From dbe4736f9ad285ef39f5c1b044b2c0f79b4055b6 Mon Sep 17 00:00:00 2001 From: Sergey Simonchik Date: Thu, 20 Feb 2014 16:41:33 +0400 Subject: [PATCH] WEB-11067 Karma Plugin broken because of missing intellijCli Node module --- .../util/src/com/intellij/util/text/SemVer.java | 11 +++++++++-- .../testSrc/com/intellij/util/text/SemVerTest.java | 14 ++++++++------ 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/platform/util/src/com/intellij/util/text/SemVer.java b/platform/util/src/com/intellij/util/text/SemVer.java index c0ca07f1c15e..5c5cdbfe849c 100644 --- a/platform/util/src/com/intellij/util/text/SemVer.java +++ b/platform/util/src/com/intellij/util/text/SemVer.java @@ -29,13 +29,20 @@ public class SemVer { private final int myMajor; private final int myMinor; private final int myPatch; + private final String myRawVersion; - public SemVer(int major, int minor, int patch) { + public SemVer(@NotNull String rawVersion, int major, int minor, int patch) { + myRawVersion = rawVersion; myMajor = major; myMinor = minor; myPatch = patch; } + @NotNull + public String getRawVersion() { + return myRawVersion; + } + public int getMajor() { return myMajor; } @@ -85,7 +92,7 @@ public class SemVer { } Integer patch = toInteger(patchStr); if (major != null && minor != null && patch != null) { - return new SemVer(major, minor, patch); + return new SemVer(text, major, minor, patch); } return null; } diff --git a/platform/util/testSrc/com/intellij/util/text/SemVerTest.java b/platform/util/testSrc/com/intellij/util/text/SemVerTest.java index 19839b424af5..5edd5d925e86 100644 --- a/platform/util/testSrc/com/intellij/util/text/SemVerTest.java +++ b/platform/util/testSrc/com/intellij/util/text/SemVerTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +15,7 @@ */ package com.intellij.util.text; -import junit.framework.Assert; +import org.junit.Assert; import org.junit.Test; /** @@ -24,15 +24,17 @@ import org.junit.Test; public class SemVerTest { @Test public void testParsing() throws Exception { - SemVer semVer = SemVer.parseFromText("0.9.2"); + String version = "0.9.2"; + SemVer semVer = SemVer.parseFromText(version); Assert.assertNotNull(semVer); - Assert.assertEquals(new SemVer(0, 9, 2), semVer); + Assert.assertEquals(new SemVer(version, 0, 9, 2), semVer); } @Test public void testExtendedVersion() throws Exception { - SemVer semVer = SemVer.parseFromText("0.9.2-dart"); + String version = "0.9.2-dart"; + SemVer semVer = SemVer.parseFromText(version); Assert.assertNotNull(semVer); - Assert.assertEquals(new SemVer(0, 9, 2), semVer); + Assert.assertEquals(new SemVer(version, 0, 9, 2), semVer); } }