summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Burmako <xeno.by@gmail.com>2012-09-17 18:56:09 +0200
committerEugene Burmako <xeno.by@gmail.com>2012-09-17 18:58:28 +0200
commit22270c68a12587d0125bd4f14c9d9f4cdcdb24d5 (patch)
treeb9ebc3ffa87c93505a7d92dbe2e1cb963c99ed8a
parent1b8330c51055b0e83b8187ac3783eabb08d8c778 (diff)
downloadscala-22270c68a12587d0125bd4f14c9d9f4cdcdb24d5.tar.gz
scala-22270c68a12587d0125bd4f14c9d9f4cdcdb24d5.tar.bz2
scala-22270c68a12587d0125bd4f14c9d9f4cdcdb24d5.zip
refactors java reflection tests
All javac-produced artifacts are now placed into test/files/lib
-rw-r--r--test/files/lib/javac-artifacts.jar.desired.sha11
-rw-r--r--test/files/run/reflection-java-annotations.check23
-rw-r--r--test/files/run/reflection-java-annotations.jar.desired.sha11
-rw-r--r--test/files/run/reflection-java-annotations.scala25
-rw-r--r--test/files/run/reflection-java-crtp.check26
-rw-r--r--test/files/run/reflection-java-crtp.jar.desired.sha11
-rw-r--r--test/files/run/reflection-java-crtp.scala27
7 files changed, 16 insertions, 88 deletions
diff --git a/test/files/lib/javac-artifacts.jar.desired.sha1 b/test/files/lib/javac-artifacts.jar.desired.sha1
new file mode 100644
index 0000000000..8dbbc1d451
--- /dev/null
+++ b/test/files/lib/javac-artifacts.jar.desired.sha1
@@ -0,0 +1 @@
+c5788c5e518eb267445c5a995fd98b2210f90a58 ?javac-artifacts.jar
diff --git a/test/files/run/reflection-java-annotations.check b/test/files/run/reflection-java-annotations.check
index 4c13ca8951..53c53cfbcc 100644
--- a/test/files/run/reflection-java-annotations.check
+++ b/test/files/run/reflection-java-annotations.check
@@ -1,22 +1 @@
-Type in expressions to have them evaluated.
-Type :help for more information.
-
-scala>
-
-scala> import scala.reflect.runtime.universe._
-import scala.reflect.runtime.universe._
-
-scala> val sym = typeOf[Foo].typeSymbol
-sym: reflect.runtime.universe.Symbol = class Foo
-
-scala> sym.typeSignature
-res0: reflect.runtime.universe.Type = java.lang.Object{def <init>(): Foo}
-
-scala> sym.getAnnotations foreach (_.javaArgs)
-
-scala> println(sym.getAnnotations)
-List(ComplexAnnotation(v1 = 1, v10 = "hello", v101 = [101, 101], v102 = [102, 102], v103 = ['g', 'g'], v104 = [104, 104], v105 = [105L, 105L], v106 = [106.0, 106.0], v107 = [107.0, 107.0], v108 = [false, true], v11 = classOf[Foo], v110 = ["hello", "world"], v111 = [classOf[SimpleAnnotation], classOf[ComplexAnnotation]], v112 = [FOO, BAR], v113 = [SimpleAnnotation(v1 = 21, v10 = "world2", v11 = classOf[ComplexAnnotation], v12 = BAR, v2 = 22, v3 = '\027', v4 = 24, v5 = 25L, v6 = 26.0, v7 = 27.0, v8 = false)], v12 = FOO, v13 = SimpleAnnotation(v1 = 11, v10 = "world1", v11 = classOf[SimpleAnnotation], v12 = FOO, v2 = 12, v3 = '\r', v4 = 14, v5 = 15L, v6 = 16.0, v7 = 17.0, v8 = false), v2 = 2, v3 = '\03', v4 = 4, v5 = 5L, v6 = 6.0, v7 = 7.0, v8 = false))
-
-scala>
-
-scala>
+List(JavaComplexAnnotation(v1 = 1, v10 = "hello", v101 = [101, 101], v102 = [102, 102], v103 = ['g', 'g'], v104 = [104, 104], v105 = [105L, 105L], v106 = [106.0, 106.0], v107 = [107.0, 107.0], v108 = [false, true], v11 = classOf[JavaAnnottee], v110 = ["hello", "world"], v111 = [classOf[JavaSimpleAnnotation], classOf[JavaComplexAnnotation]], v112 = [FOO, BAR], v113 = [JavaSimpleAnnotation(v1 = 21, v10 = "world2", v11 = classOf[JavaComplexAnnotation], v12 = BAR, v2 = 22, v3 = '\027', v4 = 24, v5 = 25L, v6 = 26.0, v7 = 27.0, v8 = false)], v12 = FOO, v13 = JavaSimpleAnnotation(v1 = 11, v10 = "world1", v11 = classOf[JavaSimpleAnnotation], v12 = FOO, v2 = 12, v3 = '\r', v4 = 14, v5 = 15L, v6 = 16.0, v7 = 17.0, v8 = false), v2 = 2, v3 = '\03', v4 = 4, v5 = 5L, v6 = 6.0, v7 = 7.0, v8 = false))
diff --git a/test/files/run/reflection-java-annotations.jar.desired.sha1 b/test/files/run/reflection-java-annotations.jar.desired.sha1
deleted file mode 100644
index efcb46fac8..0000000000
--- a/test/files/run/reflection-java-annotations.jar.desired.sha1
+++ /dev/null
@@ -1 +0,0 @@
-0b8a905f1904eb606baf8a8f25a3a0d9ba46837a ?reflection-java-annotations.jar
diff --git a/test/files/run/reflection-java-annotations.scala b/test/files/run/reflection-java-annotations.scala
index 4a4fe2572d..0b16c0d103 100644
--- a/test/files/run/reflection-java-annotations.scala
+++ b/test/files/run/reflection-java-annotations.scala
@@ -1,20 +1,7 @@
-import scala.tools.partest._
-import scala.tools.nsc.Settings
-
-object Test extends ReplTest {
- def code = """
- import scala.reflect.runtime.universe._
- val sym = typeOf[Foo].typeSymbol
- sym.typeSignature
- sym.getAnnotations foreach (_.javaArgs)
- println(sym.getAnnotations)
- """
-
- override def transformSettings(settings: Settings): Settings = {
- val thisFile = testPath.jfile.getAbsolutePath
- val javaCompiledAnnotationsJar = (thisFile stripSuffix "scala") + "jar"
- val classpath = List(sys.props("partest.lib"), sys.props("partest.reflect"), sys.props("partest.comp"), javaCompiledAnnotationsJar) mkString sys.props("path.separator")
- settings.processArguments(List("-cp", classpath), true)
- settings
- }
+object Test extends App {
+ import scala.reflect.runtime.universe._
+ val sym = typeOf[JavaAnnottee].typeSymbol
+ sym.typeSignature
+ sym.getAnnotations foreach (_.javaArgs)
+ println(sym.getAnnotations)
} \ No newline at end of file
diff --git a/test/files/run/reflection-java-crtp.check b/test/files/run/reflection-java-crtp.check
index 9fd305a7af..3e5a77e93a 100644
--- a/test/files/run/reflection-java-crtp.check
+++ b/test/files/run/reflection-java-crtp.check
@@ -1,25 +1 @@
-Type in expressions to have them evaluated.
-Type :help for more information.
-
-scala>
-
-scala> import scala.reflect.runtime.universe._
-import scala.reflect.runtime.universe._
-
-scala> val enum = typeOf[SimpleEnumeration].baseClasses(1).asClass
-enum: reflect.runtime.universe.ClassSymbol = class Enum
-
-scala> // make sure that the E's in Enum<E extends Enum<E>> are represented by the same symbol
-
-scala> val e1 = enum.typeParams(0).asType
-e1: reflect.runtime.universe.TypeSymbol = type E
-
-scala> val TypeBounds(_, TypeRef(_, _, List(TypeRef(_, e2: TypeSymbol, _)))) = e1.typeSignature
-e2: reflect.runtime.universe.TypeSymbol = type E
-
-scala> println(e1 eq e2)
-true
-
-scala>
-
-scala>
+(type E,type E,true)
diff --git a/test/files/run/reflection-java-crtp.jar.desired.sha1 b/test/files/run/reflection-java-crtp.jar.desired.sha1
deleted file mode 100644
index a29c297008..0000000000
--- a/test/files/run/reflection-java-crtp.jar.desired.sha1
+++ /dev/null
@@ -1 +0,0 @@
-3d7787300f0351f101f448ee20f05a0a512f064f ?reflection-java-crtp.jar
diff --git a/test/files/run/reflection-java-crtp.scala b/test/files/run/reflection-java-crtp.scala
index 1b08b3c6bb..260d3540dc 100644
--- a/test/files/run/reflection-java-crtp.scala
+++ b/test/files/run/reflection-java-crtp.scala
@@ -1,21 +1,8 @@
-import scala.tools.partest._
-import scala.tools.nsc.Settings
-
-object Test extends ReplTest {
- def code = """
- import scala.reflect.runtime.universe._
- val enum = typeOf[SimpleEnumeration].baseClasses(1).asClass
- // make sure that the E's in Enum<E extends Enum<E>> are represented by the same symbol
- val e1 = enum.typeParams(0).asType
- val TypeBounds(_, TypeRef(_, _, List(TypeRef(_, e2: TypeSymbol, _)))) = e1.typeSignature
- println(e1 eq e2)
- """
-
- override def transformSettings(settings: Settings): Settings = {
- val thisFile = testPath.jfile.getAbsolutePath
- val javaCompiledAnnotationsJar = (thisFile stripSuffix "scala") + "jar"
- val classpath = List(sys.props("partest.lib"), sys.props("partest.reflect"), sys.props("partest.comp"), javaCompiledAnnotationsJar) mkString sys.props("path.separator")
- settings.processArguments(List("-cp", classpath), true)
- settings
- }
+object Test extends App {
+ import scala.reflect.runtime.universe._
+ val enum = typeOf[JavaSimpleEnumeration].baseClasses(1).asClass
+ // make sure that the E's in Enum<E extends Enum<E>> are represented by the same symbol
+ val e1 = enum.typeParams(0).asType
+ val TypeBounds(_, TypeRef(_, _, List(TypeRef(_, e2: TypeSymbol, _)))) = e1.typeSignature
+ println(e1, e2, e1 eq e2)
} \ No newline at end of file