Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
8b0ffdb
1. error when no folder is found for the program
thomasNellemann-BD Sep 8, 2025
cbb2bc9
Implement REPLACE handling in Generator and add test cases for output…
thomasNellemann-BD Sep 18, 2025
08ed63f
saveing the current progress
thomasNellemann-BD Sep 18, 2025
ecc3f00
test reworked.
thomasNellemann-BD Sep 19, 2025
b855376
test for 88 level variables in FD and WS
thomasNellemann-BD Sep 19, 2025
acef5ab
Update product version to 0.2.20 and add file permission handling in …
thomasNellemann-BD Sep 26, 2025
c1a686e
Refactor file name handling in Replace class and update tests for out…
thomasNellemann-BD Sep 26, 2025
35555a7
ready to merge into parent
thomasNellemann-BD Oct 1, 2025
954b192
Update output file name tests to support cross-platform file paths
thomasNellemann-BD Oct 3, 2025
942c8ef
Approval test reworked
thomasNellemann-BD Oct 6, 2025
15f82c1
Approval test reworked
thomasNellemann-BD Oct 6, 2025
ed14916
Approval test reworked
thomasNellemann-BD Oct 6, 2025
197a4d9
linux file location changen
thomasNellemann-BD Oct 6, 2025
6b905b4
script file made executable
thomasNellemann-BD Oct 6, 2025
042caba
script file made executable
thomasNellemann-BD Oct 6, 2025
9aa3a23
extra copy script to place the approvaltest in the new folder
thomasNellemann-BD Oct 6, 2025
1d88aae
update VerifyAction.yml to include task before approval test
thomasNellemann-BD Oct 6, 2025
eeca561
back to approval files in the root of the project
thomasNellemann-BD Oct 6, 2025
486d5ef
fixes for approval files in the root
thomasNellemann-BD Oct 6, 2025
54b33e2
fixes for approval files in the root
thomasNellemann-BD Oct 6, 2025
6aa02f3
fixes for approval files in the root
thomasNellemann-BD Oct 6, 2025
d9c0a50
fixes for approval files in the root
thomasNellemann-BD Oct 6, 2025
5631b18
fixes for approval files in the root
thomasNellemann-BD Oct 6, 2025
5e2e1fe
fixing the dependsOn
thomasNellemann-BD Oct 6, 2025
0db82b9
fix location of temp files
thomasNellemann-BD Oct 6, 2025
82e323a
skip test where the os has no test prepared
thomasNellemann-BD Oct 6, 2025
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
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
*~
*.lock
*.DS_Store
*.swp
*.out
ALLTESTS
ALPHAT
Expand Down Expand Up @@ -51,7 +50,6 @@ hs_err_pid*
##############################
## Maven
##############################
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
Expand Down
Binary file removed CC##99
Binary file not shown.
Binary file removed CC##TEST
Binary file not shown.
12 changes: 6 additions & 6 deletions approvaltest
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
./cobolcheck -p NUMBERS > approval-test-actual.txt
./cobolcheck -p ALPHA >> approval-test-actual.txt
./cobolcheck -p GREETING >> approval-test-actual.txt
./cobolcheck -p FILECOPY >> approval-test-actual.txt
./cobolcheck -p MOCKTEST >> approval-test-actual.txt
./cobolcheck -p DPICNUMBERS >> approval-test-actual.txt
./temp/approvalTest/cobolcheck -p NUMBERS > ./actual-output.txt
./temp/approvalTest/cobolcheck -p ALPHA >> ./actual-output.txt
./temp/approvalTest/cobolcheck -p GREETING >> ./actual-output.txt
./temp/approvalTest/cobolcheck -p FILECOPY >> ./actual-output.txt
./temp/approvalTest/cobolcheck -p MOCKTEST >> ./actual-output.txt
./temp/approvalTest/cobolcheck -p DPICNUMBERS >> ./actual-output.txt
2 changes: 1 addition & 1 deletion approvaltestWin.cmd
Original file line number Diff line number Diff line change
@@ -1 +1 @@
./cobolcheck -p ALPHA DB2PROG DPICNUMBERS FILECOPY GREETING MOCK MOCKPARA MOCKTEST NUMBERS RETURNCODE TESTNESTED LONGLINESANDNUMBERS > approval-test-actual.txt
temp/approvalTest/cobolcheck.cmd -p NUMBERS ALPHA GREETING FILECOPY MOCKTEST DPICNUMBERS > actual-output.txt
56 changes: 38 additions & 18 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ def productName = 'cobol-check'
group = 'org.openmainframeproject'
description = 'Unit testing framework for Cobol'

def approvalExpectedOutput = "approval-test-expected.txt"
def approvalActualOutput = "output/testResults.txt"
def approvalExpectedOutput = "./expected-output.txt"
def approvalActualOutput = "./actual-output.txt"

sonarqube {
properties {
Expand Down Expand Up @@ -162,12 +162,17 @@ task copyJarToExtension(type: Copy) {

task copyRunScripts(type: Copy) {
description 'Makes copies of run scripts'

// copy and modify run scripts for bin version
from "${projectDir}/cobolcheck.cmd"
into "${projectDir}/GradleTemp"
into "${projectDir}/temp/approvalTest"
filter { line -> line.replaceAll('@VERSION@', productVersion) }
from "${projectDir}/cobolcheck"
into "${projectDir}/GradleTemp"
into "${projectDir}/temp/approvalTest"
filter { line -> line.replaceAll('@VERSION@', productVersion) }

println("Copied with jar version ${productVersion} to approvalTest directory")

}

task prepareDistribution(type: Zip) {
Expand All @@ -185,37 +190,52 @@ task prepareDistribution(type: Zip) {
rename("build/libs/(.*)", "\$1")
}

from ("${projectDir}/GradleTemp")
from ("${projectDir}/gradleBuildTemp")

doLast {
delete "GradleTemp"
delete "${projectDir}/gradleBuildTemp"
}
}

def approvalTest = tasks.register("approvalTest", Test) {
def approvalTest
approvalTest = tasks.register("approvalTest", Test) {
description 'Run approval test only'
dependsOn fatJar
dependsOn copyJarToBin, copyRunScripts

def output = -1
def weRanATest = false
def runningOs = OS_NAME.toLowerCase()

if ("${OS_NAME}" == "linux") {
if (runningOs == "linux") {
println "Linux detected"

// grant execute permission to run script
def procChmod = "chmod +x ./approvaltest".execute()
procChmod.waitForProcessOutput(System.out, System.err)

def proc = "./approvaltest".execute()
proc.waitForProcessOutput(System.out, System.err)
weRanATest = true
}
if ("${OS_NAME}".toLowerCase().contains("windows")) {
if (runningOs.contains("windows")) {
println "Windows detected"
def proc = "./approvaltestWin.cmd".execute()
proc.waitForProcessOutput(System.out, System.err)
weRanATest = true
}

output = new BuildHelper().compareFiles(approvalExpectedOutput, approvalActualOutput, true)
println "exit from compare: ${output}"

if (output != 0) {
println "*** FAIL ***"
throw new StopExecutionException("${approvalExpectedOutput} and ${approvalActualOutput} are different")
if (!weRanATest){
println "No prepared test for the OS detected: ${runningOs} - skipping"
} else {
println "${approvalExpectedOutput} matches ${approvalActualOutput} - PASS"
output = new BuildHelper().compareFiles(approvalExpectedOutput, approvalActualOutput, true)
println "exit from compare: ${output}"

if (output != 0) {
println "*** FAIL ***"
throw new StopExecutionException("${approvalExpectedOutput} and ${approvalActualOutput} are different")
} else {
println "${approvalExpectedOutput} matches ${approvalActualOutput} - PASS"
}
}
}

Expand All @@ -241,7 +261,7 @@ task osInfo {
}

class BuildHelper{
int compareFiles(String file1, String file2, boolean trimLines){
static int compareFiles(String file1, String file2, boolean trimLines){
BufferedReader reader1
BufferedReader reader2
try{
Expand Down
Binary file removed build/distributions/cobol-check-0.2.1.zip
Binary file not shown.
Binary file removed build/distributions/cobol-check-0.2.10.zip
Binary file not shown.
Binary file removed build/distributions/cobol-check-0.2.11.zip
Binary file not shown.
Binary file removed build/distributions/cobol-check-0.2.12.zip
Binary file not shown.
Binary file removed build/distributions/cobol-check-0.2.13.zip
Binary file not shown.
Binary file removed build/distributions/cobol-check-0.2.14.zip
Binary file not shown.
Binary file removed build/distributions/cobol-check-0.2.15.zip
Binary file not shown.
Binary file removed build/distributions/cobol-check-0.2.16.zip
Binary file not shown.
Binary file removed build/distributions/cobol-check-0.2.17.zip
Binary file not shown.
Binary file removed build/distributions/cobol-check-0.2.18.zip
Binary file not shown.
Binary file removed build/distributions/cobol-check-0.2.2.zip
Binary file not shown.
Binary file removed build/distributions/cobol-check-0.2.3.zip
Binary file not shown.
Binary file removed build/distributions/cobol-check-0.2.4.zip
Binary file not shown.
Binary file removed build/distributions/cobol-check-0.2.5.zip
Binary file not shown.
Binary file removed build/distributions/cobol-check-0.2.7.zip
Binary file not shown.
Binary file removed build/distributions/cobol-check-0.2.8.zip
Binary file not shown.
Binary file removed build/distributions/cobol-check-0.2.9.zip
Binary file not shown.
Empty file modified cobolcheck
100755 → 100644
Empty file.
10 changes: 5 additions & 5 deletions config.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ./
cobolcheck.test.program.path = ./testruns

#---------------------------------------------------------------------------------------------------------------------
# Suffix to append to the name of each program under test to produce the name of the corresponding
Expand All @@ -73,13 +73,13 @@ cobolcheck.test.program.name = CC##99.CBL
# 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
cobolcheck.test.unmockcall.display =false

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

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

#---------------------------------------------------------------------------------------------------------------------
# Determines the format of the test results written to the output file.
Expand Down Expand Up @@ -173,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 = ./ALLTESTS
concatenated.test.suites = ./testruns/ALLTESTS

#---------------------------------------------------------------------------------------------------------------------
# The GnuCOBOL compiler has a lot of different compile options.
Expand Down
File renamed without changes.
20 changes: 10 additions & 10 deletions src/main/cobol/MOCKTEST.CBL
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
WORKING-STORAGE SECTION.
01 FILLER.
05 VALUE-1 PIC X(80).
05 VALUE-2 PIC X(80).
05 VALUE-2 PIC X(80) Value 'initial'.
05 VALUE-3 PIC X(80).
05 TEMP PIC X(80).

Expand Down Expand Up @@ -85,15 +85,15 @@
CALL 'PROG1'
.

610-MAKE-CALL-VALUE-IN-STRUCTURE.
MOVE "1" to ACTION-PARAM
MOVE "2" to BOOK-PARAM
MOVE "3" to OUTPUT-VALUE
CALL 'MYCOBOL' USING ACTION-PARAM,
BOOK-PARAM IN BOOK-STRUCTURE,
OUTPUT-PARAM
610-CALL-VALUE-IN-STRUCTURE.
MOVE "1" to action-value
MOVE "2" to book-value
MOVE "3" to output-value
CALL 'MYCOBOL' USING action-value,
book-value IN BOOK-STRUCTURE,
output-value
END-CALL
MOVE OUTPUT-PARAM TO VALUE-1
MOVE OUTPUT-VALUE TO VALUE-1
.

700-MAKE-CALL.
Expand All @@ -115,7 +115,7 @@
BY CONTENT VALUE-1,
BY VALUE VALUE-2,
VALUE-3
CALL 'PROG3' USING VALUE-1.
CALL 'PROG3' USING VALUE-1.

900-MAKE-CALL.
CALL 'PROGRAM' USING VALUE-1
Expand Down
65 changes: 65 additions & 0 deletions src/main/cobol/REPLAC.CBL
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
IDENTIFICATION DIVISION.
PROGRAM-ID. GREETING.
*****************************************************************
* Trivial program to exercise CobolCheck.
* With regards to REPLACE statement.
*****************************************************************
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
DATA DIVISION.
WORKING-STORAGE SECTION.

REPLACE ==:PROGRAM:== BY ==REPDEMO3==
==:REQUEST:== BY ==UPDATE-MY-ADVANCED-REQUEST==
==:RESPONSE:== BY ==UPDATE-MY-ADVANCED-RESPONSE==.

123456 01 FILLER.
05 WS-COUNT PIC S9(5) COMP-3.
05 FILLER PIC X VALUE 'G'.
88 MESSAGE-IS-GREETING VALUE 'G'.
88 MESSAGE-IS-FAREWELL VALUE 'F'.
01 WS-FRIEND PIC X(10) VALUE SPACES.
01 WS-GREETING.
10 FILLER PIC X(07) VALUE 'Hello, '.
10 WS-USER-NAME PIC X(05) VALUE SPACES.
10 FILLER PIC X VALUE '!'.
01 WS-FAREWELL.
10 FILLER PIC X(15) VALUE 'See you later, '.
10 WS-USER-NAME PIC X(09) VALUE SPACES.
10 FILLER PIC X VALUE '!'.

01 :program:-param PIC X(10) VALUE "program".
01 :request:-data PIC X(10) VALUE "data data".
01 :response:-element PIC X(10) VALUE ".response.".

PROCEDURE DIVISION.

ACCEPT WS-FRIEND.


2000-SPEAK.
IF MESSAGE-IS-GREETING
IF WS-FRIEND EQUAL SPACES
MOVE 'World' TO WS-USER-NAME OF WS-GREETING
ELSE
MOVE WS-FRIEND TO WS-USER-NAME OF WS-GREETING
END-IF
END-IF
IF MESSAGE-IS-FAREWELL
IF WS-FRIEND EQUAL SPACES
MOVE 'alligator!' TO WS-USER-NAME OF WS-FAREWELL
ELSE
MOVE WS-FRIEND TO WS-USER-NAME OF WS-FAREWELL
END-IF
END-IF
.

3000-SAY-NO-MORE.
DISPLAY WS-GREETING :PROGRAM:-param
DISPLAY WS-FAREWELL :PROGRAM:-param :REQUEST:-data
DISPLAY :PROGRAM:-param :REQUEST:-data :RESPONSE:-element
.

9999-END.
.
Loading
Loading