-
-
Notifications
You must be signed in to change notification settings - Fork 193
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
add missing raise for formatting functions #1376
Conversation
@@ -28,11 +28,17 @@ let ``formatted files should report exit code 0`` () = | |||
exitCode |> should equal 0 | |||
|
|||
[<Test>] | |||
let ``invalid files should report exit code 1`` () = | |||
let ``invalid files should report exit code 1 with check`` () = |
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.
I would remove this with check
part, it is implied by the file itself.
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.
Fine
use fileFixture = new TemporaryFileCodeSample(WithErrors) | ||
let (exitCode, _) = checkCode fileFixture.Filename | ||
exitCode |> should equal 1 | ||
|
||
[<Test>] |
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.
I would move this to a new file ExitCodeTests
as this is not really related to --check
.
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.
Yeah, I think it's better this way.
In that case you think I should replicate the other tests from CheckTests
to ExitCodeTests
, replacing the function checkCode
by the function formatCode
?
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.
Hmm, I won't force you to replicate all tests. I feel like the one you have covered the need here.
The cli application isn't perfect so in this case, I would blink an eye for not having tests that cover all changes.
Maybe just clean up what you have and we can merge this.
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.
Ok
Hey Mike, that sounds about right. |
Thanks again @btzo! |
fix #1340
Running
Fantomas.CoreGlobalTool
to format a file without the--check
argument, it does the treatment in the else listed below, calling the appropriate function given type ofinputPath
andoutputPath
.fantomas/src/Fantomas.CoreGlobalTool/Program.fs
Lines 386 to 406 in d22dc76
The problem is that when an error occurred in one of these functions, it was treated locally but not propagated,
so the
try/with
condition that changes the error code to 1 is never achieved.The ideal solution would be to show only the error messages in the last
try\with
and add tests for each function in thematch
expression, besides the simple test that I inserted.What do you think @nojaf ?