Skip to content

Commit

Permalink
less periods
Browse files Browse the repository at this point in the history
  • Loading branch information
SMoRG75 committed Apr 5, 2024
1 parent b6e7921 commit 0d951e4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,16 @@ static List<String> generateSectionLines(String identifier, List<String> comment
lines.add(String.format(SECTION_HEADER_FORMAT, identifier));
if (commentLines != null)
lines.addAll(commentLines);
if (bodyLines != null)
if (bodyLines != null) {
lines.addAll(bodyLines);
lines.add(ENDING_PERIOD);
// Check if the last line in bodyLines ends with a period
if (!bodyLines.get(bodyLines.size() - 1).endsWith(".")) {
lines.add(ENDING_PERIOD);
}
} else {
// If bodyLines is null, add ENDING_PERIOD
lines.add(ENDING_PERIOD);
}
return lines;
}

Expand All @@ -32,9 +39,16 @@ static List<String> generateParagraphLines(String identifier, List<String> comme
lines.add(String.format(PARAGRAPH_HEADER_FORMAT, identifier));
if (commentLines != null)
lines.addAll(commentLines);
if (bodyLines != null)
if (bodyLines != null) {
lines.addAll(bodyLines);
lines.add(ENDING_PERIOD);
// Check if the last line in bodyLines ends with a period
if (!bodyLines.get(bodyLines.size() - 1).endsWith(".")) {
lines.add(ENDING_PERIOD);
}
} else {
// If bodyLines is null, add ENDING_PERIOD
lines.add(ENDING_PERIOD);
}
return lines;
}

Expand Down
7 changes: 0 additions & 7 deletions src/test/java/org/openmainframeproject/cobolcheck/MockIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,6 @@ public void it_inserts_call_mocks_without_commas_correctly() throws IOException
" MOVE \"Value1\" to VALUE-1 " + Constants.NEWLINE +
" EXIT SECTION " + Constants.NEWLINE +
" . " + Constants.NEWLINE+
" . " + Constants.NEWLINE+
" " + Constants.NEWLINE+
" "+ Constants.NEWLINE;

Expand Down Expand Up @@ -506,7 +505,6 @@ public void it_inserts_call_mocks_without_commas_correctly() throws IOException
" MOVE \"Value1\" to VALUE-1 " + Constants.NEWLINE +
" EXIT SECTION. " + Constants.NEWLINE +
" . " + Constants.NEWLINE+
" . " + Constants.NEWLINE+
" " + Constants.NEWLINE+
" " + Constants.NEWLINE+
" 100-WELCOME SECTION. " + Constants.NEWLINE +
Expand All @@ -530,7 +528,6 @@ public void it_inserts_call_mocks_without_commas_correctly() throws IOException
" ***************************************************************** " + Constants.NEWLINE +
" MOVE \"Hello\" to VALUE-1. " + Constants.NEWLINE +
" . " + Constants.NEWLINE +
" . " + Constants.NEWLINE +
" " + Constants.NEWLINE+
" " + Constants.NEWLINE+
" 200-GOODBYE SECTION . " + Constants.NEWLINE +
Expand All @@ -553,7 +550,6 @@ public void it_inserts_call_mocks_without_commas_correctly() throws IOException
" ***************************************************************** " + Constants.NEWLINE +
" MOVE \"Bye\" to VALUE-1 " + Constants.NEWLINE +
" . " + Constants.NEWLINE +
" . " + Constants.NEWLINE +
" " + Constants.NEWLINE+
" " + Constants.NEWLINE;

Expand Down Expand Up @@ -796,7 +792,6 @@ public void it_inserts_call_mocks_without_commas_correctly() throws IOException
" MOVE \"Value1\" to VALUE-1 " + Constants.NEWLINE +
" EXIT SECTION. " + Constants.NEWLINE +
" . " + Constants.NEWLINE+
" . " + Constants.NEWLINE +
" " + Constants.NEWLINE+
" " + Constants.NEWLINE+
" 100-WELCOME SECTION. " + Constants.NEWLINE +
Expand Down Expand Up @@ -830,7 +825,6 @@ public void it_inserts_call_mocks_without_commas_correctly() throws IOException
" CONTINUE " + Constants.NEWLINE +
" MOVE \"Hello\" to VALUE-1. " + Constants.NEWLINE +
" . " + Constants.NEWLINE +
" . " + Constants.NEWLINE +
" " + Constants.NEWLINE+
" " + Constants.NEWLINE+
" 200-GOODBYE SECTION. " + Constants.NEWLINE +
Expand Down Expand Up @@ -879,7 +873,6 @@ public void it_inserts_call_mocks_without_commas_correctly() throws IOException
" END-EVALUATE " + Constants.NEWLINE +
" CONTINUE " + Constants.NEWLINE +
" . " + Constants.NEWLINE +
" . " + Constants.NEWLINE +
" " + Constants.NEWLINE +
" " + Constants.NEWLINE +
" * Ending with comment ";
Expand Down

0 comments on commit 0d951e4

Please sign in to comment.