summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build.xml60
-rw-r--r--src/eclipse/README.md3
-rw-r--r--src/eclipse/test-junit/.classpath12
-rw-r--r--src/eclipse/test-junit/.project35
-rw-r--r--src/library/scala/collection/concurrent/TrieMap.scala7
-rw-r--r--test/files/run/t7498.scala20
-rw-r--r--test/junit/scala/tools/nsc/SampleTest.scala17
7 files changed, 150 insertions, 4 deletions
diff --git a/build.xml b/build.xml
index f12b4e8dbe..d8d0ca3bab 100644
--- a/build.xml
+++ b/build.xml
@@ -137,6 +137,7 @@ TODO:
<property name="build-quick.dir" value="${build.dir}/quick"/>
<property name="build-pack.dir" value="${build.dir}/pack"/>
<property name="build-osgi.dir" value="${build.dir}/osgi"/>
+ <property name="build-junit.dir" value="${build.dir}/junit"/>
<property name="build-strap.dir" value="${build.dir}/strap"/>
<property name="build-docs.dir" value="${build.dir}/scaladoc"/>
<property name="build-sbt.dir" value="${build.dir}/sbt-interface"/>
@@ -144,6 +145,9 @@ TODO:
<property name="test.osgi.src" value="${partest.dir}/osgi/src"/>
<property name="test.osgi.classes" value="${build-osgi.dir}/classes"/>
+ <property name="test.junit.src" value="${partest.dir}/junit"/>
+ <property name="test.junit.classes" value="${build-junit.dir}/classes"/>
+
<property name="dists.dir" value="${basedir}/dists"/>
<property name="copyright.string" value="Copyright 2002-2013, LAMP/EPFL"/>
@@ -208,6 +212,12 @@ TODO:
<dependency groupId="biz.aQute" artifactId="bnd" version="1.50.0"/>
</artifact:dependencies>
+ <!-- JUnit -->
+ <property name="junit.version" value="4.10"/>
+ <artifact:dependencies pathId="junit.classpath" filesetId="junit.fileset">
+ <dependency groupId="junit" artifactId="junit" version="${junit.version}"/>
+ </artifact:dependencies>
+
<!-- Pax runner -->
<property name="pax.exam.version" value="2.5.0"/>
<artifact:dependencies pathId="pax.exam.classpath" filesetId="pax.exam.fileset">
@@ -218,10 +228,11 @@ TODO:
<dependency groupId="org.ops4j.pax.swissbox" artifactId="pax-swissbox-framework" version="1.5.1"/>
<dependency groupId="ch.qos.logback" artifactId="logback-core" version="0.9.20"/>
<dependency groupId="ch.qos.logback" artifactId="logback-classic" version="0.9.20"/>
- <dependency groupId="junit" artifactId="junit" version="4.10"/>
+ <dependency groupId="junit" artifactId="junit" version="${junit.version}"/>
<dependency groupId="org.apache.felix" artifactId="org.apache.felix.framework" version="3.2.2"/>
</artifact:dependencies>
+
<artifact:dependencies pathId="partest.extras.classpath" filesetId="partest.extras.fileset" versionsId="partest.extras.versions">
<dependency groupId="com.googlecode.java-diff-utils" artifactId="diffutils" version="1.3.0"/>
</artifact:dependencies>
@@ -680,6 +691,12 @@ TODO:
<pathelement location="${pack.dir}/lib/scala-swing.jar"/> <!-- TODO - segregate swing tests (there can't be many) -->
</path>
+ <path id="test.junit.compiler.build.path">
+ <pathelement location="${test.junit.classes}"/>
+ <path refid="quick.compiler.build.path"/>
+ <path refid="junit.classpath"/>
+ </path>
+
<path id="test.osgi.compiler.build.path">
<pathelement location="${test.osgi.classes}"/>
<pathelement location="${build-osgi.dir}/org.scala-lang.scala-library.jar"/>
@@ -1445,6 +1462,45 @@ TODO:
<stopwatch name="quick.sbt-interface.timer" action="total"/>
</target>
+ <target name="test.junit.init" depends="quick.done">
+ <uptodate property="test.junit.available" targetfile="${build-junit.dir}/test-compile.complete">
+ <srcfiles dir="${test.junit.src}">
+ <include name="**/*.scala"/>
+ </srcfiles>
+ </uptodate>
+ </target>
+
+ <target name="test.junit.comp" depends="test.junit.init, quick.done" unless="test.junit.available">
+ <stopwatch name="test.junit.compiler.timer"/>
+ <mkdir dir="${test.junit.classes}"/>
+ <scalacfork
+ destdir="${test.junit.classes}"
+ compilerpathref="quick.compiler.path"
+ params="${scalac.args.quick}"
+ srcdir="${test.junit.src}"
+ jvmargs="${scalacfork.jvmargs}">
+ <include name="**/*.scala"/>
+ <compilationpath refid="test.junit.compiler.build.path"/>
+ </scalacfork>
+ <touch file="${build-junit.dir}/test-compile.complete" verbose="no"/>
+ <stopwatch name="test.junit.compiler.timer" action="total"/>
+ </target>
+
+ <target name="test.junit" depends="test.junit.comp">
+ <stopwatch name="test.junit.timer"/>
+ <mkdir dir="${test.junit.classes}"/>
+ <junit fork="yes" haltonfailure="yes" showoutput="yes" printsummary="on">
+ <classpath refid="test.junit.compiler.build.path"/>
+ <batchtest fork="yes" todir="${build-junit.dir}">
+ <fileset dir="${test.junit.classes}">
+ <include name="**/*Test.class"/>
+ </fileset>
+ </batchtest>
+ <formatter type="plain"/>
+ </junit>
+ <stopwatch name="test.junit.timer" action="total"/>
+ </target>
+
<property name="partest.srcdir" value="files" /> <!-- TODO: make targets for `pending` and other subdirs -->
<target name="test.run" depends="pack.done">
@@ -1516,7 +1572,7 @@ TODO:
<!-- for use in PR validation, where stability is rarely broken, so we're going to use starr for locker,
and skip test.stability (which requires locker == quick) -->
- <target name="test.core" depends="test.osgi, test.sbt, test.bc, test.interactive, test.continuations.suite, test.scaladoc, test.suite"/>
+ <target name="test.core" depends="test.osgi, test.sbt, test.bc, test.junit, test.interactive, test.continuations.suite, test.scaladoc, test.suite"/>
<target name="test.done" depends="test.core, test.stability"/>
diff --git a/src/eclipse/README.md b/src/eclipse/README.md
index 39a3f457a0..44dd3d83ea 100644
--- a/src/eclipse/README.md
+++ b/src/eclipse/README.md
@@ -11,6 +11,9 @@ IMPORTANT
Preferences/General/Workspace/Linked Resources. The value should be the absolute
path to your scala checkout. All paths in project files are relative to this one,
so nothing will work before you do so.
+Additionally, we start using Maven dependencies (e.g. junit) so you need to define
+`classpath variable` inside Eclipse. Define `M2_REPO` in Java/Build Path/Classpath Variables
+to point to your local Maven repository (e.g. $HOME/.m2/repository).
2. The Eclipse Java compiler does not allow certain calls to restricted APIs in the
JDK. The Scala library uses such APIs, so you'd see this error:
diff --git a/src/eclipse/test-junit/.classpath b/src/eclipse/test-junit/.classpath
new file mode 100644
index 0000000000..718f7b6ece
--- /dev/null
+++ b/src/eclipse/test-junit/.classpath
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="test-junit"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/reflect"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/scala-library"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="lib" path="lib/ant/ant.jar"/>
+ <classpathentry kind="lib" path="lib/jline.jar"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/scala-compiler"/>
+ <classpathentry kind="var" path="M2_REPO/junit/junit/4.10/junit-4.10.jar"/>
+ <classpathentry kind="output" path="build-test-junit"/>
+</classpath>
diff --git a/src/eclipse/test-junit/.project b/src/eclipse/test-junit/.project
new file mode 100644
index 0000000000..052b6c1b6f
--- /dev/null
+++ b/src/eclipse/test-junit/.project
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>test-junit</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.scala-ide.sdt.core.scalabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.scala-ide.sdt.core.scalanature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+ <linkedResources>
+ <link>
+ <name>build-test-junit</name>
+ <type>2</type>
+ <locationURI>SCALA_BASEDIR/build/junit/classes</locationURI>
+ </link>
+ <link>
+ <name>lib</name>
+ <type>2</type>
+ <locationURI>SCALA_BASEDIR/lib</locationURI>
+ </link>
+ <link>
+ <name>test-junit</name>
+ <type>2</type>
+ <locationURI>SCALA_BASEDIR/test/junit</locationURI>
+ </link>
+ </linkedResources>
+</projectDescription>
diff --git a/src/library/scala/collection/concurrent/TrieMap.scala b/src/library/scala/collection/concurrent/TrieMap.scala
index 6c11c5bcb5..714260fa8a 100644
--- a/src/library/scala/collection/concurrent/TrieMap.scala
+++ b/src/library/scala/collection/concurrent/TrieMap.scala
@@ -1011,8 +1011,11 @@ private[collection] class TrieMapIterator[K, V](var level: Int, private var ct:
*/
protected def subdivide(): Seq[Iterator[(K, V)]] = if (subiter ne null) {
// the case where an LNode is being iterated
- val it = subiter
- subiter = null
+ val it = newIterator(level + 1, ct, _mustInit = false)
+ it.depth = -1
+ it.subiter = this.subiter
+ it.current = null
+ this.subiter = null
advance()
this.level += 1
Seq(it, this)
diff --git a/test/files/run/t7498.scala b/test/files/run/t7498.scala
new file mode 100644
index 0000000000..1dbf0597e0
--- /dev/null
+++ b/test/files/run/t7498.scala
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+object Test extends App {
+ import scala.collection.concurrent.TrieMap
+
+ class Collision(val idx: Int) {
+ override def hashCode = idx % 10
+ }
+
+ val tm = TrieMap[Collision, Unit]()
+ for (i <- 0 until 1000) tm(new Collision(i)) = ()
+
+ tm.par.foreach(kv => ())
+}
+
diff --git a/test/junit/scala/tools/nsc/SampleTest.scala b/test/junit/scala/tools/nsc/SampleTest.scala
new file mode 100644
index 0000000000..8e026da1ea
--- /dev/null
+++ b/test/junit/scala/tools/nsc/SampleTest.scala
@@ -0,0 +1,17 @@
+package scala.tools.nsc
+package test
+
+import org.junit.Assert._
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.junit.runners.JUnit4
+
+/** Sample JUnit test that shows that all pieces
+ of JUnit infrastructure work correctly */
+@RunWith(classOf[JUnit4])
+class SampleTest {
+ @Test
+ def testMath: Unit = {
+ assert(2+2 == 4, "you didn't get the math right fellow")
+ }
+}