Add unit tests#782
Merged
yutaro-sakamoto merged 2 commits intoopensourcecobol:developfrom Feb 25, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds JUnit test coverage for key libcobj runtime call/resolve routines and wires a reusable GitHub Actions workflow to run those unit tests on push and pull request events.
Changes:
- Added new unit tests for
CobolSystemRoutine,CobolResolve, andCobolCallStackList. - Introduced a reusable
unit-test.ymlworkflow to run./gradlew testforlibcobj. - Hooked the unit-test workflow into existing
push.ymlandpull-request.ymlpipelines.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| libcobj/app/src/test/java/jp/osscons/opensourcecobol/libcobj/call/CobolSystemRoutineTest.java | Adds tests for bitwise/string/system routines; includes tests that execute real shell commands. |
| libcobj/app/src/test/java/jp/osscons/opensourcecobol/libcobj/call/CobolResolveTest.java | Adds tests around resolve, exception-map, and call-stack helpers; several call-stack tests lack assertions and share static state. |
| libcobj/app/src/test/java/jp/osscons/opensourcecobol/libcobj/call/CobolCallStackListTest.java | Adds structural tests for parent/child/sister relationships. |
| .github/workflows/unit-test.yml | New reusable workflow that runs libcobj Gradle unit tests. |
| .github/workflows/push.yml | Adds a unit-test job but doesn’t currently gate build on it. |
| .github/workflows/pull-request.yml | Adds a unit-test job but doesn’t currently gate build on it. |
Comments suppressed due to low confidence (2)
.github/workflows/push.yml:33
- The PR description says unit tests are executed “after workflow checks and before build steps”, but
buildstill onlyneeds: check-workflows, sobuildandunit-testcan run in parallel andbuildwon’t be gated on tests. If the intent is to require unit tests to pass before building, updatebuild(andbuild-utf8,coverage, etc. as appropriate) to alsoneeds: unit-test(orneeds: [check-workflows, unit-test]).
unit-test:
needs: check-workflows
uses: ./.github/workflows/unit-test.yml
build:
needs: check-workflows
strategy:
matrix:
os: ["ubuntu:24.04"]
uses: ./.github/workflows/build.yml
.github/workflows/pull-request.yml:47
- The PR description indicates unit tests should run before build steps, but
build/build-utf8only depend oncheck-workflows. As written,unit-testdoesn’t gate the builds and can execute concurrently. If builds should be blocked on unit-test success, addunit-testto theneeds:list for the build jobs (and any downstream jobs you want to gate).
unit-test:
needs: check-workflows
uses: ./.github/workflows/unit-test.yml
build:
needs: check-workflows
strategy:
matrix:
os: ["ubuntu:24.04", "almalinux:9", "amazonlinux:2023"]
uses: ./.github/workflows/build.yml
with:
os: ${{ matrix.os }}
build-utf8:
needs: check-workflows
strategy:
matrix:
os: ["ubuntu:24.04", "almalinux:9", "amazonlinux:2023"]
uses: ./.github/workflows/build.yml
with:
os: ${{ matrix.os }}
configure-args: --enable-utf8
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
libcobj/app/src/test/java/jp/osscons/opensourcecobol/libcobj/call/CobolSystemRoutineTest.java
Show resolved
Hide resolved
libcobj/app/src/test/java/jp/osscons/opensourcecobol/libcobj/call/CobolResolveTest.java
Show resolved
Hide resolved
libcobj/app/src/test/java/jp/osscons/opensourcecobol/libcobj/call/CobolResolveTest.java
Outdated
Show resolved
Hide resolved
tsh-hashimoto
approved these changes
Feb 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces a comprehensive unit testing setup for the
libcobjcomponent and integrates it with the project's GitHub Actions workflows. It adds new test cases for two core classes, significantly increasing test coverage for COBOL call stack and exception handling logic. Additionally, it establishes a reusable workflow for running unit tests and ensures these tests are executed on both push and pull request events.Testing infrastructure and workflow integration:
unit-test.yml, which checks out the code, sets up Java 21 and Gradle, and runs thelibcobjunit tests using./gradlew test.unit-testjob into bothpull-request.ymlandpush.ymlworkflows, making unit tests a required step after workflow checks and before build steps. [1] [2]Test coverage improvements:
CobolCallStackListclass, covering constructors, parent/child/sister relationships, hierarchy manipulation, and edge cases.CobolResolveclass, verifying exception mapping, call stack operations, runner resolution, and error handling.