Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scalafix-testkit: expose --save-expect helper #1147

Open
bjaglin opened this issue Jun 3, 2020 · 0 comments
Open

scalafix-testkit: expose --save-expect helper #1147

bjaglin opened this issue Jun 3, 2020 · 0 comments

Comments

@bjaglin
Copy link
Collaborator

bjaglin commented Jun 3, 2020

When adding or maintaining integration tests via scalafix-testkit, it can be useful to dump the "actual" result of running the rules to the "expected" files, in the output directory.

This is what

def main(args: Array[String]): Unit = {
if (Array("--save-expect").sameElements(args)) {
val suite = new SemanticRuleSuite(
TestkitProperties.loadFromResources(),
isSaveExpect = true
) {
testsToRun.foreach { t =>
try evaluateTestBody(t)
catch {
case _: TestFailedException =>
case NonFatal(e) =>
e.printStackTrace()
}
}
}
println("Promoted expect tests")
} else {
println(
s"unknown arguments '${args.mkString(" ")}', expected '--save-expect'"
)
}
}
does. This could be made more accessible and documented by exposing a dedicated task/command in sbt-scalafix ScalafixTestkitPlugin.

Triggered by https://github.com/scalacenter/sbt-scalafix/pull/120/files#r434473409.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant