From cf0c79a78924ca15b81494da05af7e0b48fe2c7e Mon Sep 17 00:00:00 2001 From: Christopher Vogt Date: Mon, 27 Mar 2017 19:34:20 -0400 Subject: add (currently non-working) example how to use it for built-in rewrites --- test/test.scala | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'test') diff --git a/test/test.scala b/test/test.scala index 3b296a1..b97c36e 100644 --- a/test/test.scala +++ b/test/test.scala @@ -444,6 +444,28 @@ object Main{ lib.write(sourceFile, sourceBefore) } + /* + // currently fails with + // java.lang.UnsupportedOperationException: scalafix.rewrite.ScalafixMirror.fromMirror $anon#typeSignature requires the semantic api + { + val sourceFile = cbtHome / "examples" / "scalafix-example" / "Main.scala" + val sourceBefore = sourceFile.readAsString + runCbt("../examples/scalafix-example", Seq("clean","force")) + val res = runCbt("../examples/scalafix-example", Seq("compile")) + assert(res.exit0) + val sourceAfter = sourceFile.readAsString + assert(!(sourceBefore contains "@volatile")) + assert(!(sourceBefore contains ": Unit")) + assert(!(sourceBefore contains ": String ")) + assert(!(sourceBefore contains "import scala.collection.immutable")) + assert(sourceAfter contains "@volatile") + assert(sourceAfter contains ": Unit") + assert(sourceAfter contains ": String ") + assert(sourceAfter contains "import scala.collection.immutable") + lib.write(sourceFile, sourceBefore) + } + */ + System.err.println(" DONE!") System.err.println( successes.toString ++ " succeeded, "++ failures.toString ++ " failed" ) if(failures > 0) ExitCode.Failure else ExitCode.Success -- cgit v1.2.3