Skip to content

Add unit tests#782

Merged
yutaro-sakamoto merged 2 commits intoopensourcecobol:developfrom
yutaro-sakamoto:unit-test-1
Feb 25, 2026
Merged

Add unit tests#782
yutaro-sakamoto merged 2 commits intoopensourcecobol:developfrom
yutaro-sakamoto:unit-test-1

Conversation

@yutaro-sakamoto
Copy link
Contributor

This pull request introduces a comprehensive unit testing setup for the libcobj component 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:

  • Added a new reusable GitHub Actions workflow, unit-test.yml, which checks out the code, sets up Java 21 and Gradle, and runs the libcobj unit tests using ./gradlew test.
  • Integrated the unit-test job into both pull-request.yml and push.yml workflows, making unit tests a required step after workflow checks and before build steps. [1] [2]

Test coverage improvements:

  • Added a comprehensive test suite for the CobolCallStackList class, covering constructors, parent/child/sister relationships, hierarchy manipulation, and edge cases.
  • Added an extensive test suite for the CobolResolve class, verifying exception mapping, call stack operations, runner resolution, and error handling.

@yutaro-sakamoto yutaro-sakamoto marked this pull request as ready for review February 24, 2026 02:33
Copilot AI review requested due to automatic review settings February 24, 2026 02:33
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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, and CobolCallStackList.
  • Introduced a reusable unit-test.yml workflow to run ./gradlew test for libcobj.
  • Hooked the unit-test workflow into existing push.yml and pull-request.yml pipelines.

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 build still only needs: check-workflows, so build and unit-test can run in parallel and build won’t be gated on tests. If the intent is to require unit tests to pass before building, update build (and build-utf8, coverage, etc. as appropriate) to also needs: unit-test (or needs: [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-utf8 only depend on check-workflows. As written, unit-test doesn’t gate the builds and can execute concurrently. If builds should be blocked on unit-test success, add unit-test to the needs: 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.

@yutaro-sakamoto yutaro-sakamoto merged commit da3768d into opensourcecobol:develop Feb 25, 2026
154 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants