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

Bugfix/ls24003755/ds to string when ds is greater than string #591

Conversation

davidepalladino-apuliasoft
Copy link
Collaborator

@davidepalladino-apuliasoft davidepalladino-apuliasoft commented Aug 8, 2024

Description

This work fixes the assignment of DS content to an element of array which is String with size smaller than DS.
Under the hood has been removed restriction of size, by considering that RPG truncates the DS content if the target is smaller than source, in this case a String. Then, has been applied the fix with an important refactoring of code, by using when construct. If the target is StringType, performs the right padding or truncating based of size and varying flag. For truncating, the unused method setSubstring has been refactored for the purpose.
Finally, the two simple RPG programs for tests has been developed and executed on AS400.

Related to #LS24003755

Checklist:

  • There are tests regarding this feature
  • The code follows the Kotlin conventions (run ./gradlew ktlintCheck)
  • The code passes all tests (run ./gradlew check)
  • There is a specific documentation in the docs directory

Copy link
Collaborator

@lanarimarco lanarimarco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tests are a little bit complex, making it really difficult for me to understand their purpose. Please simplify them by focusing on the essential aspects or by adding comments. Always keep in mind that a good unit test should be understandable within a few seconds, without requiring knowledge of the entire context.

@davidepalladino-apuliasoft
Copy link
Collaborator Author

The tests are a little bit complex, making it really difficult for me to understand their purpose. Please simplify them by focusing on the essential aspects or by adding comments. Always keep in mind that a good unit test should be understandable within a few seconds, without requiring knowledge of the entire context.

I added an high level comment to program RPG. The program is similar to original case:

  • by changing the name of variables with clear names;
  • by populating each field with a proper substring of Lorem ipsum....

@lanarimarco lanarimarco merged commit cd4adce into develop Aug 20, 2024
1 check passed
@lanarimarco lanarimarco deleted the bugfix/LS24003755/ds-to-string-when-ds-is-greater-than-string branch August 20, 2024 11:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants