From 24ba6cc5ccd79db3e80a6a397ce47e325d6f453b Mon Sep 17 00:00:00 2001 From: Kensuke Matsuzaki Date: Tue, 12 Jul 2011 04:59:50 +0900 Subject: [PATCH] Add two tests. --- .../tests/implementations/ExtractMethodTest.scala | 30 ++++++++++++++++++++ .../imports/OrganizeImportsTest.scala | 19 ++++++++++++ 2 files changed, 49 insertions(+), 0 deletions(-) diff --git a/org.scala-refactoring.library/src/test/scala/scala/tools/refactoring/tests/implementations/ExtractMethodTest.scala b/org.scala-refactoring.library/src/test/scala/scala/tools/refactoring/tests/implementations/ExtractMethodTest.scala index 0957a95..c73234e 100644 --- a/org.scala-refactoring.library/src/test/scala/scala/tools/refactoring/tests/implementations/ExtractMethodTest.scala +++ b/org.scala-refactoring.library/src/test/scala/scala/tools/refactoring/tests/implementations/ExtractMethodTest.scala @@ -1044,4 +1044,34 @@ object Bar { } """ } applyRefactoring extract("calc") + + + @Test + def simpleYield = new FileSet { + """ +package simpleExtract +class A { + def extractFrom { + for (i <- 0 to 100) yield { + /*(*/val j = i * 2; + j/*)*/ + } + } +} + """ becomes + """ +package simpleExtract +class A { + def extractFrom { + for (i <- 0 to 100) yield { + call i + } + } + private def call(i: Int): Int = { + /*(*/val j = i * 2; + j/*)*/ + } +} + """ + } applyRefactoring extract("call") } diff --git a/org.scala-refactoring.library/src/test/scala/scala/tools/refactoring/tests/implementations/imports/OrganizeImportsTest.scala b/org.scala-refactoring.library/src/test/scala/scala/tools/refactoring/tests/implementations/imports/OrganizeImportsTest.scala index 6d670d0..b4e950f 100644 --- a/org.scala-refactoring.library/src/test/scala/scala/tools/refactoring/tests/implementations/imports/OrganizeImportsTest.scala +++ b/org.scala-refactoring.library/src/test/scala/scala/tools/refactoring/tests/implementations/imports/OrganizeImportsTest.scala @@ -447,4 +447,23 @@ class OrganizeImportsTest extends OrganizeImportsBaseTest { def m: Either[String, ListBuffer[ListBuffer[String]]] } """ } applyRefactoring organize + + @Test + def annotateClass = new FileSet { + """ + import scala.collection.mutable.HashMap + import scala.collection.mutable.ListBuffer + + @annotation.implicitNotFound(msg = "message") + trait SomeTrait { + def m: Either[String, ListBuffer[ListBuffer[String]]] + } """ becomes + """ + import scala.collection.mutable.ListBuffer + + @annotation.implicitNotFound(msg = "message") + trait SomeTrait { + def m: Either[String, ListBuffer[ListBuffer[String]]] + } """ + } applyRefactoring organize } -- 1.7.2.5