-
-
Notifications
You must be signed in to change notification settings - Fork 40
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
Fix output format detection #1079
Conversation
Followup to #1073 That fix introduced *another* regression test, which caused the of the parser to always go to TLA. :(
This way if I break the output detection again, I'll know it before merging :)
val outfile = new File(output) | ||
val outfileName = outfile.toString() | ||
|
||
if (filename.toLowerCase.endsWith(".tla")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This had been picking up the filename
instead of the outfile
, and the filename
was the input file (artifact of shadowing and not having sufficiently careful test coverage.
val moduleName = filename.substring(0, filename.length - ".tla".length) | ||
if (outfileName.toLowerCase.endsWith(".tla")) { | ||
val moduleName = outfileName.substring(0, outfileName.length - ".tla".length) | ||
writerFactory.writeModuleToTla(rootModule.get.copy(name = moduleName), TlaWriter.STANDARD_MODULES, | ||
Some(file)) | ||
} else if (filename.toLowerCase.endsWith(".json")) { | ||
val moduleName = filename.substring(0, filename.length - ".json".length) | ||
Some(outfile)) | ||
} else if (outfileName.toLowerCase.endsWith(".json")) { | ||
val moduleName = outfileName.substring(0, outfileName.length - ".json".length) | ||
writerFactory.writeModuleToJson(rootModule.get.copy(name = moduleName), TlaWriter.STANDARD_MODULES, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The duplicate logic in these bits makes this kind of problem a bit more likely, but I'll be refactoring this as part of #1077
Dan gave a LGTM on this in slack. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
Followup to #1073
That fix introduced another regression test, which caused the of the
parser to always go to TLA. :(
make fmt-fix
(or had formatting run automatically on all files edited)