summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorLukas Rytz <lukas.rytz@gmail.com>2014-08-24 10:22:20 +0200
committerLukas Rytz <lukas.rytz@gmail.com>2014-09-02 11:26:05 +0200
commit0a6dd09d7585448d0c66835a2d2618eb12a47786 (patch)
treee4211ccf20e95143e684f78724c532e677f07988 /test
parentfc21e3b3bef59e17b3c9aa800d9288752f41853f (diff)
downloadscala-0a6dd09d7585448d0c66835a2d2618eb12a47786.tar.gz
scala-0a6dd09d7585448d0c66835a2d2618eb12a47786.tar.bz2
scala-0a6dd09d7585448d0c66835a2d2618eb12a47786.zip
Fix assertThrows, and the behaviors that it shadowed
The test in StdNamesTest was introduced in cff8b569, where newTermName would throw on a negative length. In b090f97 this was changed to fix the negative length, but the test was not adapted (as it didn't fail).
Diffstat (limited to 'test')
-rw-r--r--test/junit/scala/tools/nsc/symtab/CannotHaveAttrsTest.scala4
-rw-r--r--test/junit/scala/tools/nsc/symtab/FreshNameExtractorTest.scala4
-rw-r--r--test/junit/scala/tools/nsc/symtab/StdNamesTest.scala8
-rw-r--r--test/junit/scala/tools/testing/AssertUtil.scala2
4 files changed, 12 insertions, 6 deletions
diff --git a/test/junit/scala/tools/nsc/symtab/CannotHaveAttrsTest.scala b/test/junit/scala/tools/nsc/symtab/CannotHaveAttrsTest.scala
index 355771bf04..d424f12710 100644
--- a/test/junit/scala/tools/nsc/symtab/CannotHaveAttrsTest.scala
+++ b/test/junit/scala/tools/nsc/symtab/CannotHaveAttrsTest.scala
@@ -47,7 +47,7 @@ class CannotHaveAttrsTest {
assertEquals(t.tpe, NoType)
}
- @Test
+ @Test @org.junit.Ignore // SI-8816
def nonDefaultPosAssignmentFails = {
val pos = new OffsetPosition(null, 0)
attrlessTrees.foreach { t =>
@@ -56,7 +56,7 @@ class CannotHaveAttrsTest {
}
}
- @Test
+ @Test @org.junit.Ignore // SI-8816
def nonDefaultTpeAssignmentFails = {
val tpe = typeOf[Int]
attrlessTrees.foreach { t =>
diff --git a/test/junit/scala/tools/nsc/symtab/FreshNameExtractorTest.scala b/test/junit/scala/tools/nsc/symtab/FreshNameExtractorTest.scala
index cf09abdfff..effbfb2f7c 100644
--- a/test/junit/scala/tools/nsc/symtab/FreshNameExtractorTest.scala
+++ b/test/junit/scala/tools/nsc/symtab/FreshNameExtractorTest.scala
@@ -36,7 +36,7 @@ class FreshNameExtractorTest {
}
}
- @Test
+ @Test @org.junit.Ignore // SI-8818
def extractionsFailsIfNameDoesntEndWithNumber = {
val Creator = new FreshNameCreator(prefixes.head)
val Extractor = new FreshNameExtractor(prefixes.head)
@@ -44,4 +44,4 @@ class FreshNameExtractorTest {
val Extractor(_) = TermName(Creator.newName("foo") + "bar")
}
}
-} \ No newline at end of file
+}
diff --git a/test/junit/scala/tools/nsc/symtab/StdNamesTest.scala b/test/junit/scala/tools/nsc/symtab/StdNamesTest.scala
index 4a39cf9d48..524d2e45e0 100644
--- a/test/junit/scala/tools/nsc/symtab/StdNamesTest.scala
+++ b/test/junit/scala/tools/nsc/symtab/StdNamesTest.scala
@@ -15,12 +15,16 @@ class StdNamesTest {
@Test
def testNewTermNameInvalid(): Unit = {
- assertThrows[IllegalArgumentException](newTermName("foo".toCharArray, 0, -1))
- assertThrows[IllegalArgumentException](newTermName("foo".toCharArray, 0, 0))
assertThrows[IllegalArgumentException](newTermName("foo".toCharArray, -1, 1))
}
@Test
+ def testNewTermNameNegativeLenght(): Unit = {
+ assertEquals(nme.EMPTY, newTermName("foo".toCharArray, 0, -1))
+ assertEquals(nme.EMPTY, newTermName("foo".toCharArray, 0, 0))
+ }
+
+ @Test
def testUnspecializedName(): Unit = {
def test(expected: Name, nme: Name) {
assertEquals(expected, unspecializedName(nme))
diff --git a/test/junit/scala/tools/testing/AssertUtil.scala b/test/junit/scala/tools/testing/AssertUtil.scala
index 9a97c5114f..9b4833d46b 100644
--- a/test/junit/scala/tools/testing/AssertUtil.scala
+++ b/test/junit/scala/tools/testing/AssertUtil.scala
@@ -19,6 +19,8 @@ object AssertUtil {
val clazz = manifest.runtimeClass
if (!clazz.isAssignableFrom(e.getClass))
throw e
+ else return
}
+ throw new AssertionError("Expression did not throw!")
}
}