Files
Chess/.github/workflows/go.yml
MSWS 54d81edb33 test: Refactor tests and workflows; comment out main function
- Comment out the main function implementation in `main.go` to disable functionality for now.
- Remove the "indirect" comment from the dependency declaration in `go.mod`.
- Add tests for the `testdata` directory.

[main.go]
- Commented out the entire main function implementation, including code for initializing the board, retrieving moves, iterating over moves, and printing outputs.
- No functional code remains active in the main function.
[go.mod]
- Removed the "indirect" comment from the dependency declaration.
[.github/workflows/go.yml]
- Updated the "Set up Go environment" step to specify Go version 1.22.8.
- Added an additional command to run tests specifically on the `testdata` directory.
- Ensured consistency and expanded test coverage in the workflow.
[board/board_test.go]
- Removed an unnecessary log statement from an En Passant test case.
- Tests verify UndoMove behavior:
  - Active player correctly switches between turns.
  - Original board position is restored after undoing moves.
  - Castling rights are properly updated upon undoing moves.
- Improved En Passant test cases:
  - Validation that pawn restoration works after an undo.
  - Correctly marks and restores En Passant availability from moves and FEN configurations.
  - Verifies board state integrity after multiple moves and undos involving En Passant captures.
2025-03-22 17:55:32 -07:00

30 lines
633 B
YAML

name: Go Build and Test
on:
push:
paths:
- "**/*.go"
- ".github/workflows/go.yml"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
go-build-and-test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Go environment
uses: actions/setup-go@v4
with:
go-version: '1.22.8' # Replace with your required Go version
- name: Find and process directories with go.mod
run: |
go build
go test -v -cover ./...
go test -v ./testdata/