diff options
author | Christopher Vogt <oss.nsp@cvogt.org> | 2017-03-27 19:34:20 -0400 |
---|---|---|
committer | Christopher Vogt <oss.nsp@cvogt.org> | 2017-03-28 09:39:16 -0400 |
commit | cf0c79a78924ca15b81494da05af7e0b48fe2c7e (patch) | |
tree | 1aa232fbd9d4e4bdd59d86e0b9e58c28e0a0220b /test/test.scala | |
parent | 2c792df95d36d61c55b07ddfa13387cf79371bdb (diff) | |
download | cbt-cf0c79a78924ca15b81494da05af7e0b48fe2c7e.tar.gz cbt-cf0c79a78924ca15b81494da05af7e0b48fe2c7e.tar.bz2 cbt-cf0c79a78924ca15b81494da05af7e0b48fe2c7e.zip |
add (currently non-working) example how to use it for built-in rewrites
Diffstat (limited to 'test/test.scala')
-rw-r--r-- | test/test.scala | 22 |
1 files changed, 22 insertions, 0 deletions
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 |