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

304 call mocks are not matching call signatures when one or more program parameters are qualified #308

Merged
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ LAUNCHTESTT
CC##*

# project specific

testsuites/concatenatedTestsuites
*.hprof
envvars
target/
Expand Down
132 changes: 132 additions & 0 deletions src/main/cobol/MOCK.CBL
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
IDENTIFICATION DIVISION.
PROGRAM-ID. MOCK.
/****************************************************************
* Program to exercise different mock statements and edge cases.
*****************************************************************
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 FILLER.
05 VALUE-1 PIC X(80).
05 VALUE-2 PIC X(80).
05 VALUE-3 PIC X(80).
05 TEMP PIC X(80).

01 COBOL-structure.
05 ACTION-PARAM pic x(1).
05 book-PARAM pic x(1).
05 output-value pic x(12).

PROCEDURE DIVISION.

000-START SECTION.
MOVE "Value1" to VALUE-1
MOVE "Value2" to VALUE-2
/
PERFORM 100-WELCOME
PERFORM 200-GOODBYE
/
PERFORM 300-CHANGE-1
PERFORM 400-CHANGE-2
PERFORM 500-SWITCH
PERFORM 999-END
EXIT SECTION.
/**********************
100-WELCOME SECTION
.
MOVE "Hello" to VALUE-1
MOVE "Hi" to VALUE-2
EXIT SECTION
.
/*************************
* KALD KTOMHDR, HENT OP
**************************
200-GOODBYE SECTION.
* Comment for testing purposes
MOVE "Bye" to VALUE-1
MOVE "See you" to VALUE-2
EXIT SECTION
.

300-CHANGE-1
*Comment for testing purposes
.
EVALUATE VALUE-1
WHEN "Hello"
MOVE "Bye" TO VALUE-1
WHEN "Bye"
MOVE "Hello" TO VALUE-1
WHEN OTHER
EXIT PARAGRAPH
END-EVALUATE.
/*************************
* KALD KTOMHDR, HENT OP
**************************

400-CHANGE-2 SECTION
.
EVALUATE VALUE-2
WHEN "Hi"
MOVE "See you" TO VALUE-2
EXIT SECTION
WHEN OTHER
MOVE "Hi" TO VALUE-2
EXIT SECTION
END-EVALUATE
.
/*************************
* KALD KTOMHDR, HENT OP
**************************

410-PLACEHOLDER SECTION.
CONTINUE
.

500-SWITCH.
MOVE VALUE-2 TO TEMP
MOVE VALUE-1 TO VALUE-2
MOVE TEMP TO VALUE-1.

600-MAKE-CALL.
MOVE "arg1" to VALUE-1
MOVE "arg2" to VALUE-2
CALL 'PROG1'
.

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

700-MAKE-CALL.
MOVE "arg1" to VALUE-1
MOVE "arg2" to VALUE-2
CALL VALUE-2 USING VALUE-1
CALL VALUE-2
END-CALL.

800-MAKE-CALL.
MOVE "arg1" to VALUE-1
MOVE "arg2" to VALUE-2
MOVE "arg3" to VALUE-3
CALL 'PROG3' USING
BY CONTENT VALUE-1,
BY VALUE VALUE-2,
VALUE-3.
CALL 'PROG3' USING
BY CONTENT VALUE-1,
BY VALUE VALUE-2,
VALUE-3
CALL 'PROG3' USING VALUE-1.

999-END.
GOBACK
.
16 changes: 16 additions & 0 deletions src/main/cobol/MOCKTEST.CBL
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
05 VALUE-3 PIC X(80).
05 TEMP PIC X(80).

01 Book-structure.
05 action-value pic x(1).
05 book-value pic x(1).
05 output-value pic x(12).

PROCEDURE DIVISION.

000-START SECTION.
Expand Down Expand Up @@ -80,6 +85,17 @@
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
END-CALL
MOVE OUTPUT-PARAM TO VALUE-1
.

700-MAKE-CALL.
MOVE "arg1" to VALUE-1
MOVE "arg2" to VALUE-2
Expand Down
Loading
Loading