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

Attempt to merge develop into branch #278

Merged
Show file tree
Hide file tree
Changes from 10 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
2 changes: 1 addition & 1 deletion .github/workflows/VerifyAction.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
branches:
- '*'
pull_request:
branches: [ main ]
branches: [ main,Developer ]

jobs:
build:
Expand Down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,8 @@ nb-configuration.xml
## OS X
##############################
.DS_Store
output/testResults.txt
approval-test-actual.txt
default.conf
null
ParserErrorLog.txt
339 changes: 8 additions & 331 deletions ALLTESTS
Original file line number Diff line number Diff line change
@@ -1,331 +1,8 @@
*From file: C:\Udvikler\Workspace\cobol-check-main\src\test\cobol\MOCKTEST\BeforeAfterTest.cut
GhettoKiwi marked this conversation as resolved.
Show resolved Hide resolved
TestSuite "Before and after tests 1"

BEFORE-EACH
MOVE "prepare" TO VALUE-1
END-BEFORE

AFTER-EACH
MOVE "clean" TO VALUE-2
END-AFTER

TestCase "Before sets value"
EXPECT VALUE-1 TO BE "prepare"

TestCase "After sets value"
EXPECT VALUE-2 TO BE "clean"

TestCase "Before happens before Testcase"
MOVE "during" TO VALUE-1
EXPECT VALUE-1 TO BE "during"

TestCase "After happens after Testcase (part 1)"
MOVE "during" TO VALUE-2
EXPECT VALUE-2 TO BE "during"

TestCase "After happens after Testcase (part 2)"
EXPECT VALUE-2 TO BE "clean"


TestSuite "Before and after tests 2"
BEFORE-EACH
MOVE "before1" TO VALUE-1
MOVE "before2" TO VALUE-2
PERFORM 000-START
END-BEFORE

AFTER EACH
MOVE "clean up" TO VALUE-3
PERFORM 100-WELCOME
END-AFTER


MOCK SECTION 000-START
MOVE "GlobalMockedSection1" TO VALUE-1
END-MOCK

MOCK SECTION 100-WELCOME
MOVE "GlobalMockedSection2" TO VALUE-3
END-MOCK

TestCase "Performs of mocked items does not influence count"
VERIFY SECTION 000-START HAPPENED 0 TIMES
VERIFY SECTION 100-WELCOME NEVER HAPPENED

TestCase "Only global mocks apply in before/after (part 1)"
MOVE "arg3" TO VALUE-3
MOCK SECTION 000-START
MOVE "LocalMockedSection1" TO VALUE-1
END-MOCK
MOCK SECTION 100-WELCOME
MOVE "LocalMockedSection2" TO VALUE-3
END-MOCK
EXPECT VALUE-1 TO BE "GlobalMockedSection1"
EXPECT VALUE-2 TO BE "before2"
EXPECT VALUE-3 TO BE "arg3"

TestCase "Only global mocks apply in before/after (part 2)"
MOCK SECTION 000-START
MOVE "LocalMockedSection1" TO VALUE-1
END-MOCK
MOCK SECTION 100-WELCOME
MOVE "LocalMockedSection2" TO VALUE-3
END-MOCK
EXPECT VALUE-1 TO BE "GlobalMockedSection1"
EXPECT VALUE-2 TO BE "before2"
EXPECT VALUE-3 TO BE "GlobalMockedSection2"

TestCase "Only global mocks apply in before/after (part 3)"
MOCK SECTION 000-START
MOVE "LocalMockedSection1" TO VALUE-1
END-MOCK
MOCK SECTION 100-WELCOME
MOVE "LocalMockedSection2" TO VALUE-3
END-MOCK
EXPECT VALUE-1 TO BE "GlobalMockedSection1"
EXPECT VALUE-2 TO BE "before2"
EXPECT VALUE-3 TO BE "GlobalMockedSection2"

TestSuite "Before and after tests 3"

BEFORE EACH
MOVE "before" TO VALUE-1
END-BEFORE

AFTER-EACH
MOVE "after" TO VALUE-1
END-AFTER

TestCase "Before proceeds after from last testcase (part 1)"
EXPECT VALUE-1 TO BE "before"

TestCase "Before proceeds after from last testcase (part 2)"
EXPECT VALUE-1 TO BE "before"
*From file: C:\Udvikler\Workspace\cobol-check-main\src\test\cobol\MOCKTEST\GeneralTest.cut
TestSuite "General tests"

TestCase "No Expect or Verify"
PERFORM 100-WELCOME

TestCase "Welcome section performs as intended"
PERFORM 100-WELCOME
Expect VALUE-1 to be "Hello"
Expect VALUE-2 to be "Hi"

TestCase "Goodbye section performs as intended"
PERFORM 200-GOODBYE
Expect VALUE-1 to be "Bye"
Expect VALUE-2 to be "See you"

TestCase "Change-1 changes hello to bye"
PERFORM 100-WELCOME
PERFORM 300-CHANGE-1
Expect VALUE-1 to be "Bye"
Expect VALUE-2 to be "Hi"

TestCase "Change-1 changes bye to hello"
PERFORM 200-GOODBYE
PERFORM 300-CHANGE-1
Expect VALUE-1 to be "Hello"
Expect VALUE-2 to be "See you"

TestCase "Change-2 changes hi to see you"
PERFORM 100-WELCOME
PERFORM 400-CHANGE-2
Expect VALUE-1 to be "Hello"
Expect VALUE-2 to be "See you"

TestCase "Change-2 changes see you to hi"
PERFORM 200-GOODBYE
PERFORM 400-CHANGE-2
Expect VALUE-1 to be "Bye"
Expect VALUE-2 to be "Hi"

TestCase "Switches values"
PERFORM 100-WELCOME
PERFORM 500-SWITCH
Expect VALUE-1 to be "Hi"
Expect VALUE-2 to be "Hello"
*From file: C:\Udvikler\Workspace\cobol-check-main\src\test\cobol\MOCKTEST\MockCallTest.cut
* Test for mocking call statements
* Writing a comment to test stuff
*
*Yeah
*
TestSuite "Mock Call statements test"

MOCK CALL 'PROG1'
MOVE "Global PROG1" TO VALUE-1
END-MOCK

TestCase "Simple call mock works"
MOCK CALL 'PROG1'
MOVE "From mocked PROG1" TO VALUE-1
END-MOCK
PERFORM 600-MAKE-CALL
EXPECT VALUE-1 TO BE "From mocked PROG1"
EXPECT VALUE-2 TO BE "arg2"
VERIFY CALL 'PROG1' HAPPENED ONCE

TestCase "Simple global call mock works"
PERFORM 600-MAKE-CALL
EXPECT VALUE-1 TO BE "Global PROG1"
EXPECT VALUE-2 TO BE "arg2"
VERIFY CALL 'PROG1' HAPPENED ONCE

TestCase "Call mock with argument works"
MOCK CALL VALUE-2 USING VALUE-1
MOVE "From mocked PROG2" TO VALUE-1
END-MOCK
PERFORM 700-MAKE-CALL
EXPECT VALUE-1 TO BE "From mocked PROG2"
EXPECT VALUE-2 TO BE "arg2"
VERIFY CALL VALUE-2 USING VALUE-1
HAPPENED ONCE

* Test for mocking call statements
* Writing a comment to test stuff
*
*Yeah
*
TestCase "Call mock with content reference for arguments work"
MOCK CALL 'PROG3' USING
BY CONTENT VALUE-1,
BY VALUE VALUE-2,
VALUE-3
MOVE "content" TO VALUE-1
MOVE "value" TO VALUE-2
MOVE "reference" TO VALUE-3
END-MOCK
PERFORM 800-MAKE-CALL
EXPECT VALUE-1 TO BE "content"
EXPECT VALUE-2 TO BE "value"
EXPECT VALUE-3 TO BE "reference"
VERIFY CALL 'PROG3' USING
BY CONTENT VALUE-1,
BY VALUE VALUE-2,
VALUE-3
HAPPENED 2 TIMES

TestCase "Paragraph mock is called and call mock is ignored"
MOCK CALL 'PROG3' USING
BY CONTENT VALUE-1,
BY VALUE VALUE-2,
VALUE-3
MOVE "content" TO VALUE-1
MOVE "value" TO VALUE-2
MOVE "reference" TO VALUE-3
END-MOCK
MOCK PARAGRAPH 800-MAKE-CALL
MOVE "overwritten" TO VALUE-1
END-MOCK
MOVE "arg2" TO VALUE-2
MOVE "arg3" TO VALUE-3
PERFORM 800-MAKE-CALL
EXPECT VALUE-1 TO BE "overwritten"
EXPECT VALUE-2 TO BE "arg2"
EXPECT VALUE-3 TO BE "arg3"
VERIFY PARAGRAPH 800-MAKE-CALL HAPPENED ONCE
VERIFY CALL 'PROG3' USING
BY CONTENT VALUE-1,
BY VALUE VALUE-2,
VALUE-3
NEVER HAPPENED

TestCase "Global call mock is not overwritten by local call mock (Should fail)"
MOCK CALL 'PROG1'
MOVE "Local PROG1" TO VALUE-1
END-MOCK
PERFORM 600-MAKE-CALL
EXPECT VALUE-1 TO BE "Global PROG1"
*From file: C:\Udvikler\Workspace\cobol-check-main\src\test\cobol\MOCKTEST\MockSectionsAndParagraphsTest.cut
TestSuite "Mock Sections And Paragraphs"

MOCK SECTION 000-START
PERFORM 100-WELCOME
PERFORM 500-SWITCH
END-MOCK

MOCK PARAGRAPH 300-CHANGE-1
EVALUATE VALUE-1
WHEN "Hello"
MOVE "MOCKED" TO VALUE-1
WHEN OTHER
MOVE "mocked" TO VALUE-1
END-EVALUATE
END-MOCK

TestCase "Global mock behaves as intended"
PERFORM 000-START
Expect VALUE-1 to be "Hi"
Expect VALUE-2 to be "Hello"
VERIFY SECTION 000-START HAPPENED ONCE
VERIFY PARAGRAPH 300-CHANGE-1 HAPPENED ZERO TIMES

TestCase "Local mock overwrites global mock"
MOCK SECTION 000-START
MOVE "This is" TO VALUE-1
MOVE "a mock" TO VALUE-2
END-MOCK
PERFORM 000-START
PERFORM 000-START
Expect VALUE-1 to be "This is"
Expect VALUE-2 to be "a mock"
VERIFY SECTION 000-START HAPPENED AT LEAST 2 TIMES

TestCase "Multiple local mocks behaves as intended (First Verify should fail)"
MOCK SECTION 000-START
MOVE "This is" TO VALUE-1
MOVE "a mock" TO VALUE-2
PERFORM 100-WELCOME
PERFORM 100-WELCOME
PERFORM 100-WELCOME
END-MOCK
MOCK SECTION 100-WELCOME
MOVE "I'll leave VALUE-2 alone" TO VALUE-1
END-MOCK
MOCK PARAGRAPH 500-SWITCH
END-MOCK
PERFORM 000-START
PERFORM 000-START
VERIFY SECTION 000-START HAPPENED 5 TIMES
Expect VALUE-1 to be "I'll leave VALUE-2 alone"
VERIFY SECTION 100-WELCOME HAPPENED NO MORE THAN 10 TIMES
VERIFY PARAGRAPH 500-SWITCH NEVER HAPPENED
Expect VALUE-2 to be "a mock"

TestCase "Empty local mock makes section do nothing"
MOCK PARAGRAPH 500-SWITCH
END-MOCK
PERFORM 100-WELCOME
PERFORM 500-SWITCH
Expect VALUE-1 to be "Hello"
Expect VALUE-2 to be "Hi"
VERIFY PARAGRAPH 500-SWITCH HAPPENED ONCE

TestCase "Local and global mocks can be used together"
MOCK SECTION 100-WELCOME
MOVE "Mockity-" TO VALUE-1
MOVE "Mock" TO VALUE-2
END-MOCK
PERFORM 000-START
Expect VALUE-1 to be "Mock"
Expect VALUE-2 to be "Mockity-"

TestCase "If no local or global mock run source code"
PERFORM 100-WELCOME
Expect VALUE-1 to be "Hello"
Expect VALUE-2 to be "Hi"

TestCase "Global paragraph mock works"
PERFORM 100-WELCOME
PERFORM 300-CHANGE-1
Expect VALUE-1 to be "MOCKED"
Expect VALUE-2 to be "Hi"

TestCase "Mock with EXIT SECTION in source works"
MOCK SECTION 400-CHANGE-2
MOVE "Exit section is handled correctly" TO VALUE-1
END-MOCK
PERFORM 400-CHANGE-2
Expect VALUE-1 to be "Exit section is handled correctly"
*From file: C:\workspace\cobol-check\src\test\cobol\DB2PROG\DB2TEST.cut
TestSuite "Tests of DB2 includes"

TestCase "DB2 Copybook added to PRG"
move "John" to FIRST-NAME
move "Doe" to LAST-NAME
Expect FIRST-NAME to be "John"
Expect LAST-NAME to be "Doe"
Loading