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

Prepare for new version release #325

Merged
merged 7 commits into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 2 additions & 12 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,13 @@ src/test/cobol/TESTPRG.CBL
*.dll
*.exe

#Cobol-check VS CODE extension
vs code extension/**/package-lock.json
vs code extension/**/out
vs code extension/**/node_modules
vs code extension/**/client/server
vs code extension/**/.vscode-test
vs code extension/**/Jenkinsfile
vs code extension/Cobol-check/output/testResults.html
# Below is made bu ./gradlew prepareDistribution!vs code extension/Cobol-check/bin/*

vs-code-extension/**/package-lock.json
vs-code-extension/**/out
vs-code-extension/**/node_modules
vs-code-extension/**/client/server
vs-code-extension/**/.vscode-test
vs-code-extension/**/Jenkinsfile
vs-code-extension/Cobol-check/output/testResults.html
# Below is made bu ./gradlew prepareDistribution
!vs-code-extension/Cobol-check/bin/*

# Java-related gitignore entries from: https://gist.github.com/dedunumax/54e82214715e35439227
##############################
Expand All @@ -53,6 +41,8 @@ vs-code-extension/Cobol-check/output/testResults.html
.mtj.tmp/
*.class
*.jar
# Below is made by ./gradlew prepareDistribution
!vs-code-extension/Cobol-check/bin/*.jar
*.war
*.ear
*.nar
Expand Down
22 changes: 18 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,32 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Mock SQL tables
- Mock batch file I/O

## \[0.2.8\] 2023-05-16 - Unreleased
## \[0.2.8\] 2023-10-17
### Implemented
- Proper handling of END-EXEC without trailing period in WORKING-STORAGE

## \[0.2.7\] 2023-03-21 - Unreleased
- Fixed bugs in input argument handling
- Fixed bug with spaces in path
- Added default return code
- Added ability to mock and verify calls without commas separating arguments
- Fixes to the linter
- Greatly improved management of mocked sections
- Added the usage of test tree instead of own test run panel
- Fixed a bug where numeric fields where not properly identified
- Added a warning when a call was attempted and not mocked, and the ability to throw an error instead
- Updated metadata on the extension
- Improved usage of the Gnu COBOL compiler
- Updated the test workflows
- Added expanding of copybooks in exec-sql statements
- And lots of other minor things

## \[0.2.7\] 2023-03-21
### Implemented
- EXPECT now properly handles variable subscription without a space delimiter (EXPECT varibable(idx) TO BE 1)
- COBOL level item 77 now handled properly
- More robust scanning of WORKING-STORAGE items
- Corrected assignment of the various COBOL computational binary field types.

## \[0.2.6\] 2023-01-12 - Unreleased
## \[0.2.6\] 2023-01-12
### Implemented
- Datastructure-verification for Working Storage has been added.

Expand Down
Binary file modified build/distributions/cobol-check-0.2.8.zip
Binary file not shown.
30 changes: 14 additions & 16 deletions config.properties
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ cobolcheck.stub.comment.tag = null
cobolcheck.decimalPointIsComma = false

#---------------------------------------------------------------------------------------------------------------------
# If the source program contains rules as the first line follwed by CBL, the given value will be appended
# If the source program contains rules as the first line followed by CBL, the given value will be appended
# to this.
# If no CBL is found in source, it will be added along with the given value
# default is null, which will make no changes.
Expand All @@ -58,7 +58,7 @@ cobolcheck.append.rules = null
# cobolcheck.test.program.path = /home/myName/temp
# cobolcheck.test.program.path = c:\\Developer\\temp
# cobolcheck.test.program.path = c:/Developer/temp
cobolcheck.test.program.path = Cobol-check
cobolcheck.test.program.path = ./

#---------------------------------------------------------------------------------------------------------------------
# Suffix to append to the name of each program under test to produce the name of the corresponding
Expand All @@ -68,17 +68,18 @@ cobolcheck.test.program.path = Cobol-check
cobolcheck.test.program.name = CC##99.CBL

#---------------------------------------------------------------------------------------------------------------------
# If the given value is true, then the test with unmocked calls will be echoed and test summary
# will contain the number of unmocked calls.
# Default: true
# Indicates whether or not report should be thrown, if COBOL Check encounters an unmocked call
# When false, no action is taken, when encountering unmocked calls.
# When true, COBOL Check will report the unmocked calls, and the test summary will contain the number of unmocked calls.
# Default: false
#---------------------------------------------------------------------------------------------------------------------
cobolcheck.test.unmockcall.display = false

#---------------------------------------------------------------------------------------------------------------------
# Path for the generated testsuite parse error log
# Default: ./
#---------------------------------------------------------------------------------------------------------------------
testsuite.parser.error.log.path = Cobol-check
testsuite.parser.error.log.path = ./

#---------------------------------------------------------------------------------------------------------------------
# Name of the generated testsuite parse error log file - with extension
Expand Down Expand Up @@ -131,13 +132,13 @@ test.suite.directory = src/test/cobol
#---------------------------------------------------------------------------------------------------------------------
# Location of test output. File extension is determined by a given format.
#---------------------------------------------------------------------------------------------------------------------
test.results.file = vs-code-extension/Cobol-check/output/testResults
test.results.file = output/testResults

#---------------------------------------------------------------------------------------------------------------------
# Determines the format of the test results written to the output file.
# Supported formats: txt, xml, html.
#---------------------------------------------------------------------------------------------------------------------
test.results.format = html
test.results.format = txt

#---------------------------------------------------------------------------------------------------------------------
# Determines the format style of the test results written to the output file.
Expand All @@ -147,7 +148,7 @@ test.results.format = html
# Other formats and styles can be used interchangeably.
# Supported styles: directOutput, JUnit, tableDocument, tableEmbed
#---------------------------------------------------------------------------------------------------------------------
test.results.format.style = tableDocument
test.results.format.style = directOutput

#---------------------------------------------------------------------------------------------------------------------
# If application source filenames have a suffix, specify it here without the period or dot.
Expand All @@ -172,7 +173,7 @@ application.copybook.filename.suffix = CBL,cbl,COB,cob,CPY,cpy
# This is the relative or absolute path of the concatenated file. If not specified, the default
# is "./ALLTESTS" relative to the directory in which Cobol Check was started.
#---------------------------------------------------------------------------------------------------------------------
concatenated.test.suites = Cobol-check/ALLTESTS
concatenated.test.suites = ./ALLTESTS

#---------------------------------------------------------------------------------------------------------------------
# The GnuCOBOL compiler has a lot of different compile options.
Expand All @@ -184,7 +185,7 @@ concatenated.test.suites = Cobol-check/ALLTESTS
# Example:
# gnucobol.compile.options = -std=ibm,-fsingle-quote
#---------------------------------------------------------------------------------------------------------------------
gnucobol.compile.options = -std=ibm,-fsingle-quote,-fnot-reserved=EVENT
gnucobol.compile.options = null

#---------------------------------------------------------------------------------------------------------------------
# Shell scripts and JCL files for executing your test suites.
Expand All @@ -197,13 +198,10 @@ gnucobol.compile.options = -std=ibm,-fsingle-quote,-fnot-reserved=EVENT
# Cobol Check will select one of these entries based on which platform it thinks it's running on.
#---------------------------------------------------------------------------------------------------------------------

cobolcheck.script.directory = Cobol-check/scripts
cobolcheck.script.directory = scripts
linux.process = linux_gnucobol_run_tests
osx.process = linux_gnucobol_run_tests
freebsd.process = linux_gnucobol_run_tests
windows.process = windows_gnucobol_run_tests.cmd
zos.process =
unix.process = linux_gnucobol_run_tests
cobol_run_tests
cobol_run_tests

unix.process = linux_gnucobol_run_tests
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,9 @@ private void updateLineRepository(CobolLine line) throws IOException {
extractedCopyBook = lineRepository.addExpandedCopyDB2Statements(reader.readStatementAsOneLine());
for (int i = 0; i < extractedCopyBook.size(); i++) {
CobolLine cobolLine = new CobolLine(extractedCopyBook.get(i), tokenExtractor);
List<CobolLine> currentStatement = new ArrayList<>();
currentStatement.add(cobolLine);
this.currentDataStructure = updateCurrentDataStructure(currentStatement, currentDataStructure);
updateNumericFields(cobolLine);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class MockGenerator {
private final String endEvaluateLine = " END-EVALUATE";
private final String continueLine = " CONTINUE";

public final static String performUnMockPara = " PERFORM PROCESS-UNMOCK-CALL";
public final static String performUnMockPara = " PERFORM UT-PROCESS-UNMOCK-CALL";

private final String countMockInitialWSHeader = " 01 %sMOCKS-GENERATED.";
private final String initializeMockCountParagraphHeader = " %sINITIALIZE-MOCK-COUNT.";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1125,11 +1125,11 @@ boolean fieldIsANumericDataType(String fieldNameForExpect) {
}
}
}

return numericFields.dataTypeOf(fieldNameForExpect) == DataType.PACKED_DECIMAL
|| (numericFields.dataTypeOf(fieldNameForExpect) == DataType.FLOATING_POINT)
|| (numericFields.dataTypeOf(fieldNameForExpect) == DataType.BINARY)
|| (numericFields.dataTypeOf(fieldNameForExpect) == DataType.DISPLAY_NUMERIC);
DataType fieldNameDataType = numericFields.dataTypeOf(fieldNameForExpect);
return fieldNameDataType== DataType.PACKED_DECIMAL
|| (fieldNameDataType == DataType.FLOATING_POINT)
|| (fieldNameDataType == DataType.BINARY)
|| (fieldNameDataType == DataType.DISPLAY_NUMERIC);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class TestSuiteParserController {
private List<String> parsedTestSuiteLines;

// The boilerplate copybooks for cobol-check test code inserted into Working-Storage and Procedure.
// The names are a throwback to the proof-of-concept project, cobol-unit-test. Might change in future.
// The names are a throwback to the proof-of-concept project, cobol-unit-test. Might change in the future.
private static final String workingStorageCopybookFilename = "CCHECKWS.CPY";
private static final String procedureDivisionResultCopybookFilename = "CCHECKRESULTPD.CPY";
private static final String procedureDivisionParagraphCopybookFilename = "CCHECKPARAGRAPHSPD.CPY";
Expand Down Expand Up @@ -238,16 +238,18 @@ public List<String> generateBeforeAfterBranchParagraphs(boolean withComments){

public List<String> generateCobolLinesForUnmockedCalls() {
List<String> cobolLines = new ArrayList<>();
cobolLines.add(" PROCESS-UNMOCK-CALL.");
cobolLines.add(" UT-PROCESS-UNMOCK-CALL.");
if(Config.getDisplayUnMockedCalls()) {
String line1 = " Add 1 to %sNUMBER-UNMOCK-CALL";
String line2 = " display \"Call not mocked in testcase \" %1$sTEST-CASE-NAME \" in testsuite \" %1$sTEST-SUITE-NAME";
String line3 = " display \"All used calls should be mocked, to ensure the unit test has control over input data\"";
String line2 = " display \"Call not mocked in testcase: \" %1$sTEST-CASE-NAME ";
String line3 = " display \" in testsuite: \" %1$sTEST-SUITE-NAME";
String line4 = " display \"All used calls should be mocked, to ensure the unit test has control over input data\"";

String testCodePrefix = Config.getTestCodePrefix();
cobolLines.add(String.format(line1, testCodePrefix));
cobolLines.add(String.format(line2, testCodePrefix));
cobolLines.add(line3);
cobolLines.add(String.format(line3, testCodePrefix));
cobolLines.add(line4);
}
cobolLines.add(" CONTINUE");
cobolLines.add(" .");
Expand Down Expand Up @@ -281,13 +283,6 @@ public List<String> getEndEvaluateLine(){
return lines;
}

public List<String> getContinueLine(){
List<String> lines = new ArrayList<>();
lines.add(mockGenerator.getContinueLine());
CobolGenerator.addStartAndEndTags(lines);
return lines;
}

public void logUnusedMocks(){
testSuiteErrorLog.logUnusedMocks(mockRepository.getMocks());
}
Expand All @@ -302,7 +297,6 @@ public void logUnusedMocks(){
*/
public List<String> getBoilerplateCodeFromCopybooks(String copybookFilename) throws IOException {
List<String> lines = new ArrayList<>();
boolean isComma = Config.isDecimalPointComma();
String path = Constants.COBOLCHECK_COPYBOOK_DIRECTORY + copybookFilename;
InputStream is = this.getClass().getResourceAsStream(path);
BufferedReader secondarySourceBufferedReader = new BufferedReader(new InputStreamReader(is));
Expand Down
2 changes: 1 addition & 1 deletion src/test/cobol/DPICNUMBERS/NumbersExpect.cut
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Move 25,74 to VALUE-1
Expect VALUE-1 = 25,74

TestCase "simple expect for number"
TestCase "simple expect for number with mock"
MOCK PARAGRAPH 100-ASSIGN
MOVE 105 TO VALUE-1
END-MOCK
Expand Down
6 changes: 3 additions & 3 deletions src/test/cobol/NUMBERS/SymbolicRelationsTest.cut
Original file line number Diff line number Diff line change
Expand Up @@ -196,19 +196,19 @@
move 475.063 to ws-field-1
expect ws-field-1 not <= 475.062

TestCase "Not greater-than-or-equal-to-sign with field compare when equal (should fail)"
TestCase "Not less-than-or-equal-to-sign with field compare when equal (should fail)"
move 475.062 to ws-field-1
expect ws-field-1 not <= 475.062

TestCase "Not greater-than-or-equal-to-sign with field compare when less (should fail)"
TestCase "Not less-than-or-equal-to-sign with field compare when less (should fail)"
move 475.062 to ws-field-1
expect ws-field-1 not <= 475.063

TestCase "Display Numeric field equals literal"
move 123.45 to ws-display-field
expect ws-display-field to be 123.45

TestCase "Display Numeric field equals literal"
TestCase "Display Numeric field equals literal with negative numbers"
move -123.45 to ws-display-field
expect ws-display-field to be -123.45

Expand Down
Loading
Loading