Skip to content

Commit

Permalink
Merge remote branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
rlegendi committed Apr 29, 2012
2 parents 62cce78 + ba52ed6 commit 27c4bb5
Show file tree
Hide file tree
Showing 144 changed files with 9,936 additions and 258 deletions.
4 changes: 2 additions & 2 deletions org.scala-ide.build-toolchain/build-toolchain-2.9.x.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
. $(dirname $0)/env.sh

# Scala compiler version to be used as a dependency
SCALA_VERSION=2.9.2-SNAPSHOT
SCALA_VERSION=2.9.3-SNAPSHOT

# Scala library version
SCALA_LIBRARY_VERSION=2.9.2-SNAPSHOT
SCALA_LIBRARY_VERSION=2.9.3-SNAPSHOT

#THIS NEEDS TO BE UPDATED ONCE WE HAVE SNAPSHOTS

Expand Down
4 changes: 2 additions & 2 deletions org.scala-ide.build-toolchain/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
</parent>

<artifactId>scala-toolchain-for-eclipse</artifactId>
<version>2.9.2-SNAPSHOT</version>
<version>2.9.3-SNAPSHOT</version>
<name>The Scala Toolchain for Eclipse</name>
<packaging>pom</packaging>

<properties>
<sbt.version>0.11.2-scalaide-04</sbt.version>
<sbt.version>0.11.2-scalaide-05</sbt.version>
<scala.compiler.groupid>org.scala-lang</scala.compiler.groupid>
<scala.library.version>${scala.version}</scala.library.version>
<scala.compiler.version>${scala.version}</scala.compiler.version>
Expand Down
4 changes: 3 additions & 1 deletion org.scala-ide.build/build-ide-2.9.x.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

. $(dirname $0)/env.sh

SCALA_VERSION=2.9.2-SNAPSHOT
SCALA_VERSION=2.9.3-SNAPSHOT

PROFILE="-P scala-2.9.x"

build $*
2 changes: 2 additions & 0 deletions org.scala-ide.build/build-ide-trunk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@

SCALA_VERSION=2.10.0-SNAPSHOT

PROFILE="-P scala-trunk"

build $*
62 changes: 40 additions & 22 deletions org.scala-ide.build/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
<module>../org.scala-ide.sdt.aspects</module>
<module>../org.scala-ide.sdt.core</module>
<module>../org.scala-ide.sdt.core.tests</module>
<module>../org.scala-ide.sdt.debug</module>
<module>../org.scala-ide.sdt.debug.tests</module>
<module>../org.scala-ide.sdt.feature</module>
<module>../org.scala-ide.sdt.source.feature</module>
<module>../org.scala-ide.sdt.update-site</module>
Expand Down Expand Up @@ -138,47 +140,62 @@
</pluginRepositories>
<profiles>
<profile>
<id>scala-2.9.2-SNAPSHOT</id>
<activation>
<property>
<name>scala.version</name>
<value>2.9.2-SNAPSHOT</value>
</property>
</activation>
<id>release-ide-29</id>
<properties>
<version.suffix>2_09</version.suffix>
</properties>
<repositories>
<repository>
<id>scala-refactoring-trunk</id>
<name>Scala Refactoring Scala 2.9.2-SNAPSHOT p2 repository</name>
<id>scala-refactoring-scalaide-2.0</id>
<name>Scala Refactoring for Scala IDE 2.0 p2 repository</name>
<layout>p2</layout>
<url>${repo.scala-ide}/scala-refactoring-2.9.2-SNAPSHOT</url>
<url>${repo.scala-ide}/incoming-release-29/dependencies/scala-refactoring</url>
</repository>
<repository>
<id>scalariform-trunk</id>
<name>Scalariform Scala 2.9.2-SNAPSHOT p2 repo</name>
<id>scalariform-scalaide-2.0</id>
<name>Scalariform for Scala IDE 2.0 p2 repo</name>
<layout>p2</layout>
<url>${repo.scala-ide}/scalariform-2.9.2-SNAPSHOT</url>
<url>${repo.scala-ide}/incoming-release-29/dependencies/scalariform</url>
</repository>
<repository>
<id>scala-toolchain-scalaide-2.0</id>
<name>Scala Toolchain for Scala IDE 2.0 p2 repository</name>
<layout>p2</layout>
<url>${repo.scala-ide}/incoming-release-29/dependencies/osgi-toolchain</url>
</repository>
</repositories>
</profile>

<profile>
<id>scala-2.9.x</id>
<properties>
<version.suffix>2_09</version.suffix>
</properties>
<repositories>
<repository>
<id>scala-refactoring-29x</id>
<name>Scala Refactoring Scala 2.9.x p2 repository</name>
<layout>p2</layout>
<url>${repo.scala-ide}/scala-refactoring-29x</url>
</repository>
<repository>
<id>scalariform-29x</id>
<name>Scalariform Scala 2.9.x p2 repo</name>
<layout>p2</layout>
<url>${repo.scala-ide}/scalariform-29x</url>
</repository>
<repository>
<id>scala-toolchain-2.9.2-SNAPSHOT</id>
<name>Scala Toolchain 2.9.2-SNAPSHOT p2 repository</name>
<id>scala-toolchain-29x</id>
<name>Scala Toolchain 2.9.x p2 repository</name>
<layout>p2</layout>
<url>${repo.scala-ide}/scala-eclipse-toolchain-osgi-2.9.2-SNAPSHOT</url>
<url>${repo.scala-ide}/scala-eclipse-toolchain-osgi-29x</url>
<!-- <url>file:/absolute/path/to/org.scala-ide.build-toolchain/mkrepo/scala-eclipse-toolchain-osgi-2.9.2-SNAPSHOT</url> -->
</repository>
</repositories>
</profile>

<profile>
<id>scala-trunk</id>
<activation>
<property>
<name>scala.version</name>
<value>2.10.0-SNAPSHOT</value>
</property>
</activation>
<repositories>
<repository>
<id>scala-refactoring-trunk</id>
Expand All @@ -200,6 +217,7 @@
</repository>
</repositories>
</profile>

<!-- local 2.9.x-SNAPSHOT -->
<profile>
<id>local-scala-2.9.x</id>
Expand Down
9 changes: 9 additions & 0 deletions org.scala-ide.build/release-build-ide-2.9.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh

. $(dirname $0)/env.sh

SCALA_VERSION=2.9.2-RC3

PROFILE="-P release-ide-29"

build $*
2 changes: 1 addition & 1 deletion org.scala-ide.sbt.full.library/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.scala-ide</groupId>
<artifactId>scala-toolchain-for-eclipse</artifactId>
<version>2.9.2-SNAPSHOT</version>
<version>2.9.3-SNAPSHOT</version>
<relativePath>../org.scala-ide.build-toolchain/pom.xml</relativePath>
</parent>
<artifactId>org.scala-ide.sbt.full.library</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion org.scala-ide.scala.compiler/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.scala-ide</groupId>
<artifactId>scala-toolchain-for-eclipse</artifactId>
<version>2.9.2-SNAPSHOT</version>
<version>2.9.3-SNAPSHOT</version>
<relativePath>../org.scala-ide.build-toolchain/pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion org.scala-ide.scala.library/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.scala-ide</groupId>
<artifactId>scala-toolchain-for-eclipse</artifactId>
<version>2.9.2-SNAPSHOT</version>
<version>2.9.3-SNAPSHOT</version>
<relativePath>../org.scala-ide.build-toolchain/pom.xml</relativePath>
</parent>
<artifactId>org.scala-ide.scala.library</artifactId>
Expand Down
2 changes: 2 additions & 0 deletions org.scala-ide.sdt.core.tests/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ Bundle-ClassPath: .,
lib/mockito-all-1.8.5.jar
Require-Bundle: org.scala-ide.scala.library,
org.eclipse.equinox.weaving.aspectj
Export-Package:
scala.tools.eclipse.testsetup
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import scala.tools.eclipse.ui.TestBracketStrategy;
import scala.tools.eclipse.pc.PresentationCompilerTest;
import scala.tools.eclipse.wizards.*;
import scala.tools.eclipse.util.*;


import org.junit.runner.RunWith;
Expand Down Expand Up @@ -59,6 +60,8 @@
ProjectDependenciesTest.class,
MultipleErrorsTest.class,
TestBracketStrategy.class,
SymbolClassifierTestSuite.class
SymbolClassifierTestSuite.class,
CachedTest.class,
CollectionUtilTest.class
})
class TestsSuite { }
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,21 @@ import org.mockito.Mockito._
import org.junit.Assert._
import org.junit.Test
import scala.tools.eclipse.testsetup.TestProjectSetup
import org.eclipse.jdt.core.search.{SearchEngine, IJavaSearchConstants, IJavaSearchScope, SearchPattern, TypeNameRequestor}
import org.eclipse.jdt.core.search.{ SearchEngine, IJavaSearchConstants, IJavaSearchScope, SearchPattern, TypeNameRequestor }
import org.eclipse.jdt.core.IJavaElement
import org.junit.Ignore
import scala.tools.nsc.util.OffsetPosition

object CompletionTests extends TestProjectSetup("completion")


class CompletionTests {
import CompletionTests._

import org.eclipse.core.runtime.IProgressMonitor
import org.eclipse.jface.text.IDocument
import org.eclipse.jdt.ui.text.java.ContentAssistInvocationContext

private def withCompletions(path2source: String)(body: (Int, OffsetPosition, List[CompletionProposal]) => Unit) {
private def withCompletions(path2source: String)(body: (Int, OffsetPosition, List[CompletionProposal]) => Unit) {
val unit = compilationUnit(path2source).asInstanceOf[ScalaCompilationUnit]

// first, 'open' the file by telling the compiler to load it
Expand All @@ -44,17 +43,16 @@ class CompletionTests {
// seems to get lost when the position where completion is asked
val positions = SDTTestUtils.positionsOf(contents, " /*!*/")
val content = unit.getContents.mkString

val completion = new ScalaCompletions
for (i <- 0 until positions.size) {
val pos = positions(i)

val position = new scala.tools.nsc.util.OffsetPosition(src, pos)
var wordRegion = ScalaWordFinder.findWord(content, position.offset.get)


// val selection = mock(classOf[ISelectionProvider])


// val selection = mock(classOf[ISelectionProvider])

/* FIXME:
* I would really love to call `completion.computeCompletionProposals`, but for some unclear
* reason that call is not working. Some debugging shows that the position is not right (off by one),
Expand All @@ -70,13 +68,14 @@ class CompletionTests {
import collection.JavaConversions._
val completions: List[ICompletionProposal] = completion.computeCompletionProposals(context, monitor).map(_.asInstanceOf[ICompletionProposal]).toList
*/
body(i, position, completion.findCompletions(wordRegion)(pos+1, unit)(src, compiler))

body(i, position, completion.findCompletions(wordRegion)(pos + 1, unit)(src, compiler))
}
}()
}

/** @param withImportProposal take in account proposal for types not imported yet
/**
* @param withImportProposal take in account proposal for types not imported yet
*/
private def runTest(path2source: String, withImportProposal: Boolean)(expectedCompletions: List[String]*) {

Expand Down Expand Up @@ -107,27 +106,56 @@ class CompletionTests {
}
}
}

/** Transform the given completion proposal into a string that is (hopefully)
* compiler-version independent.
*

/**
* Transform the given completion proposal into a string that is (hopefully)
* compiler-version independent.
*
* Transformations are:
* - remove parenthesis
* - java.lang.String => String
*/
private def normalizeCompletion(str: String): String = {
str.replace("(","").replace(")","").replace("java.lang.String", "String")
str.replace("(", "").replace(")", "").replace("java.lang.String", "String")
}


/**
* Test that completion shows only accessible members.
*/
@Test
def accessibilityTests() {
val oraclePos14 = List("secretPrivate: Unit",
"secretProtected: Unit",
"secretProtectedInPackage: Unit",
"secretPublic: Unit")

val oraclePos16 = List("secretPrivate: Unit",
"secretPrivateThis: Unit",
"secretProtected: Unit",
"secretProtectedInPackage: Unit",
"secretPublic: Unit")
val oraclePos22 = List(
"secretProtected: Unit",
"secretProtectedInPackage: Unit",
"secretPublic: Unit")
val oraclePos28 = List(
"secretProtectedInPackage: Unit",
"secretPublic: Unit")
val oraclePos37 = List(
"secretPublic: Unit")

runTest("accessibility/AccessibilityTest.scala", true)(oraclePos14, oraclePos16, oraclePos22, oraclePos28, oraclePos37)
}

@Test
def ticket1000475() {
val oraclePos73 = List("toString(): String")
val oraclePos116 = List("forallChar => Boolean: Boolean")
val oraclePos147 = List("forallChar => Boolean: Boolean")

runTest("ticket_1000475/Ticket1000475.scala", false)(oraclePos73, oraclePos116, oraclePos147)
}

/**
* Test completion for 'any' Java type visible in the project
*/
Expand All @@ -139,21 +167,43 @@ class CompletionTests {

runTest("ticket_1000476/Ticket1000476.scala", true)(oraclePos4_26, oraclePos6_33, oraclePos11_16)
}

@Test
def ticket1000654() {
val oraclePos10_13 = List("t654_a(String): Unit", "t654_a(Int): Unit")

runTest("ticket_1000654/Ticket1000654.scala", true)(oraclePos10_13)
}

@Test
def ticket1000772() {
val OracleNames = List(List("param1", "param2"), List("secondSectionParam1"))
withCompletions("ticket_1000772/CompletionsWithName.scala") { (idx, position, completions) =>
assertEquals("Only one completion expected at (%d, %d)".format(position.line, position.column), 1, completions.size)
assertEquals("Expected the following names: %s".format(OracleNames),
OracleNames, completions(0).explicitParamNames)
OracleNames, completions(0).explicitParamNames)
}
}

/**
* This is more a structure builder problem, but it is visible through completion
*/

def checkPackageNameOnSingleCompletion(sourcePath: String, expected: Seq[(String, String)]) {
withCompletions(sourcePath) { (idx, position, completions) =>
assertEquals("Only one completion expected at (%d, %d)".format(position.line, position.column), 1, completions.size)
assertEquals("Unexpected package name", expected(idx)._1, completions(0).displayDetail)
assertEquals("Unexpected the class name", expected(idx)._2, completions(0).display)
}
}

@Test
def ticket1000855_1() {
checkPackageNameOnSingleCompletion("ticket_1000855/a/A.scala", Seq(("a.b", "T855B")))
}

@Test
def ticket1000855_2() {
checkPackageNameOnSingleCompletion("ticket_1000855/d/D.scala", Seq(("a.b.c", "T855C"), ("a.b.e", "T855E")))
}
}
Loading

0 comments on commit 27c4bb5

Please sign in to comment.