-
Notifications
You must be signed in to change notification settings - Fork 28
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
276 support on EXCEPTION in CALLs #311
276 support on EXCEPTION in CALLs #311
Conversation
Signed-off-by: Akash Kumar <[email protected]>
Signed-off-by: Akash Kumar <[email protected]>
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.
Thank you for removing the formatting changes, it helps a lot :-D
I would like you to consider if it is possible to tests how mocks work with CALL ON EXCEPTION statements.
And take a look at how the code manages CALL ON EXCEPTION that ends with a period, see my commet.
And if you can find a solution to my comment about the commented call in the resulting code, it would be awesome :-D
callTokenCount++; | ||
} | ||
if (token.equals(Constants.END_CALL_TOKEN)) { | ||
endCallTokenCount++; |
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 think this might break if the "end-call-token" is replaced with a period.
Try making this test:
CALL "PROGRAM" USING DATA-1 ON EXCEPTION
DISPLAY "ERROR".
CALL "PROGRAM" USING DATA-1 ON EXCEPTION
DISPLAY "ERROR".
What code does that result in?
It should look something like this:
- CALL "PROGRAM" USING DATA-1 ON EXCEPTION DISPLAY "ERROR".
- CALL "PROGRAM" USING DATA-1 ON EXCEPTION DISPLAY "ERROR".
But I think it will concatenate it like this: - CALL "PROGRAM" USING DATA-1 ON EXCEPTION DISPLAY "ERROR". CALL
- "PROGRAM" USING DATA-1 ON EXCEPTION DISPLAY "ERROR".
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.
@Rune-Christensen
Thanks for the question.
The If
conditions above line 166 will take care of the period terminator preventing the code from breaking.
The above code is returning the below code:
*CALL "PROGRAM" USING DATA-1 ON EXCEPTION
* DISPLAY "ERROR"
CONTINUE
.
*CALL "PROGRAM" USING DATA-1 ON EXCEPTION
* DISPLAY "ERROR".
CONTINUE
.
I have also added tests in my new PR :)
Regards,
Akash Kumar
" . " + Constants.NEWLINE + | ||
" " + Constants.NEWLINE + | ||
" *CALL \"PROGRAM\" USING VALUE-1 ON EXCEPTION PERFORM 100-WELCOME END " + Constants.NEWLINE + | ||
" * -CALL. " + Constants.NEWLINE + |
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 do not like the way that the entire call statement is concatenated into a string, and then split over the required number of lines.
I would prefer that the comment looks something like this, that preserves the original lines and spacing:
* CALL \"PROGRAM\" USING VALUE-1
* ON EXCEPTION
* PERFORM 100-WELCOME
* END-CALL.
If you can find an easy fix for that, it would be awesome :-D
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.
@Rune-Christensen
Thanks for raising this issue.
I have added code for this in my latest PR.
The commit link is : add pretty format for multiline comment statements
@Rune-Christensen |
@AkashKumar7902 At the moment, we do not want the MOCK CALL statement, to contain ON EXCEPTION as part of the signature. |
Fixes: #276