diff options
author | Adriaan Moors <adriaan.moors@typesafe.com> | 2013-08-14 13:27:03 -0700 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@typesafe.com> | 2013-08-14 13:27:03 -0700 |
commit | 275194a62989115e065ff69c41942f113db8b8f7 (patch) | |
tree | 64722697ea2a22f1499cc92574da00fa888a16a8 /test | |
parent | 8949ba3fa875166776d08c6600849d1eb531d832 (diff) | |
parent | 8f5a892512ba848a52a4ddd5d79e9c79d12ccfc1 (diff) | |
download | scala-275194a62989115e065ff69c41942f113db8b8f7.tar.gz scala-275194a62989115e065ff69c41942f113db8b8f7.tar.bz2 scala-275194a62989115e065ff69c41942f113db8b8f7.zip |
Merge pull request #2791 from som-snytt/issue/7265-2.11
SI-7265 javaSpecVersion, adjust isJava... tests for 2.11
Diffstat (limited to 'test')
-rw-r--r-- | test/files/run/t7265.scala | 27 | ||||
-rw-r--r-- | test/junit/scala/util/t7265.scala (renamed from test/pending/junit/scala/util/t7265.scala) | 13 |
2 files changed, 13 insertions, 27 deletions
diff --git a/test/files/run/t7265.scala b/test/files/run/t7265.scala deleted file mode 100644 index c556930303..0000000000 --- a/test/files/run/t7265.scala +++ /dev/null @@ -1,27 +0,0 @@ - -import scala.util.Properties._ - -object Test extends App { - - setProp("java.specification.version", "1.7") - - assert( isJavaAtLeast("1.5")) - assert( isJavaAtLeast("1.6")) - assert( isJavaAtLeast("1.7")) - assert(!isJavaAtLeast("1.8")) - assert(!isJavaAtLeast("1.71")) - - failing(isJavaAtLeast("1.a")) - failing(isJavaAtLeast("1")) - failing(isJavaAtLeast("")) - failing(isJavaAtLeast(".")) - failing(isJavaAtLeast(".5")) - failing(isJavaAtLeast("1.7.1")) - - def failing(u: =>Unit) = try { - u - assert(false, "Expected Exception") - } catch { - case _: NumberFormatException => - } -} diff --git a/test/pending/junit/scala/util/t7265.scala b/test/junit/scala/util/t7265.scala index 3b8fa80dbe..71f085d21d 100644 --- a/test/pending/junit/scala/util/t7265.scala +++ b/test/junit/scala/util/t7265.scala @@ -30,6 +30,7 @@ class SpecVersionTest { assert(sut isJavaAtLeast "1.6") assert(sut isJavaAtLeast "1.7") assert(!(sut isJavaAtLeast "1.8")) + assert(!(sut isJavaAtLeast "1.71")) } @Test(expected = classOf[NumberFormatException]) def badVersion(): Unit = { @@ -40,6 +41,18 @@ class SpecVersionTest { sut isJavaAtLeast "1" } @Test(expected = classOf[NumberFormatException]) + def noVersion(): Unit = { + sut isJavaAtLeast "" + } + @Test(expected = classOf[NumberFormatException]) + def dotOnly(): Unit = { + sut isJavaAtLeast "." + } + @Test(expected = classOf[NumberFormatException]) + def leadingDot(): Unit = { + sut isJavaAtLeast ".5" + } + @Test(expected = classOf[NumberFormatException]) def notASpec(): Unit = { sut isJavaAtLeast "1.7.1" } |