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

Multi mock issue #100

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions src/main/cobol/MOCKISSU.CBL
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
**********************************************************************
* AUTHOR: SEBSATIEN FAUVEL
* DATE: 25 SEPT 2019
* PURPOSE: DEMONSTRATE MOCKING ISSUE OF ZUTZCPC.
**********************************************************************
IDENTIFICATION DIVISION.
PROGRAM-ID. MOCKDEMO.
ENVIRONMENT DIVISION.

DATA DIVISION.

WORKING-STORAGE SECTION.

PROCEDURE DIVISION.

1000-PARA-A.
* do nothing
.

2000-PARA-B.
* do nothing
.

9999-END.
.
13 changes: 13 additions & 0 deletions src/main/cobol/ZUTZCPC.CBL
Original file line number Diff line number Diff line change
Expand Up @@ -1826,6 +1826,19 @@
PERFORM 3960-COPY-OR-COMMENT-LINES

* Replace the original behavior with the mocked behavior.
INITIALIZE TEST-LINE
STRING ' MOVE "' MOCK-LOOKUP-KEY '"'
DELIMITED '.'
INTO TEST-LINE
WRITE TEST-LINE

MOVE ' TO UT-MOCK-FIND-PARA-NAME'
TO TEST-LINE
WRITE TEST-LINE

MOVE ' PERFORM UT-LOOKUP-MOCK'
TO TEST-LINE
WRITE TEST-LINE

MOVE INCR-MOCK-ACCESS-COUNT-STMT
TO TEST-LINE
Expand Down
39 changes: 39 additions & 0 deletions src/test/cobol/unit-tests/MOCKISST
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
TESTSUITE 'DEMONSTRATE FILE MOCKS'

*****************************************************************
* UNIT TESTS TO DEMONSTRATE MOCKING FEATURES OF ZUTZCPC.
*****************************************************************

TESTCASE 'IT MOCKS PARAGRAPH 2000-PARA-B'
MOCK
PARAGRAPH 2000-PARA-B
* do nothing
END-MOCK
PERFORM 2000-PARA-B
VERIFY PARAGRAPH 2000-PARA-B WAS PERFORMED ONCE

TESTCASE 'IT MOCKS PARAGRAPH 1000-PARA-A'
MOCK
PARAGRAPH 1000-PARA-A
* do nothing
END-MOCK
PERFORM 1000-PARA-A
VERIFY PARAGRAPH 1000-PARA-A WAS PERFORMED ONCE

TESTCASE 'IT MOCKS PARAGRAPH 1000-PARA-A and 2000-PARA-B'
MOCK
PARAGRAPH 1000-PARA-A
* do nothing
END-MOCK
MOCK
PARAGRAPH 2000-PARA-B
* do nothing
END-MOCK

PERFORM 1000-PARA-A
VERIFY PARAGRAPH 1000-PARA-A WAS PERFORMED ONCE
VERIFY PARAGRAPH 2000-PARA-B WAS NEVER PERFORMED




2 changes: 2 additions & 0 deletions src/test/resources/MOCKISSC
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ZUTZCWS
MOCKISST