diff options
author | Adriaan Moors <adriaan.moors@typesafe.com> | 2013-07-12 12:08:13 -0700 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@typesafe.com> | 2013-07-12 12:08:13 -0700 |
commit | 1035bb3916474d5beb955dde23e6ed45be8cfd05 (patch) | |
tree | b0f8b90f7f1ca6bfd900e70d830c846fbaac84e6 /test/files/run | |
parent | 8bcb848fd2d00eabe224a9dd6384dbf19d76ce9f (diff) | |
parent | 06606e83dc942693dd95a30f704876c41eb4d8e5 (diff) | |
download | scala-1035bb3916474d5beb955dde23e6ed45be8cfd05.tar.gz scala-1035bb3916474d5beb955dde23e6ed45be8cfd05.tar.bz2 scala-1035bb3916474d5beb955dde23e6ed45be8cfd05.zip |
Merge pull request #2666 from som-snytt/issue/7265-spec-at-least
SI-7265 General test for spec version
Diffstat (limited to 'test/files/run')
-rw-r--r-- | test/files/run/t7265.scala | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/files/run/t7265.scala b/test/files/run/t7265.scala new file mode 100644 index 0000000000..c556930303 --- /dev/null +++ b/test/files/run/t7265.scala @@ -0,0 +1,27 @@ + +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 => + } +} |