Skip to content

Conversation

k1LoW
Copy link
Owner

@k1LoW k1LoW commented Aug 14, 2025

This pull request introduces a new type alias for exec.ExitError and adds comprehensive tests to ensure its correct usage and compatibility. The main focus is on verifying the type identity and behavior of the new alias, as well as its interoperability with the original os/exec.ExitError.

Type alias addition:

  • Added a type alias ExitError for exec.ExitError in exec.go, allowing for simplified and consistent error handling throughout the codebase.

Testing enhancements:

  • Introduced a new TestExitError test suite in exec_test.go to verify the type identity between ExitError and exec.ExitError, including bidirectional type assertions and ensuring they reference the same underlying object.
  • Added tests to confirm that commands failing with non-zero exit codes produce errors that can be asserted to both ExitError and exec.ExitError, and that their methods (ExitCode, Error, and ProcessState) behave as expected.
  • Extended tests to cover error handling for commands run with CommandContext, ensuring the alias works in this context as well.

@k1LoW k1LoW self-assigned this Aug 14, 2025
@k1LoW k1LoW added the enhancement New feature or request label Aug 14, 2025

This comment has been minimized.

@k1LoW k1LoW added the minor label Aug 14, 2025
Copy link
Contributor

Code Metrics Report

main (53364b4) #7 (fb9c112) +/-
Coverage 89.1% 89.1% 0.0%
Code to Test Ratio 1:1.5 1:2.0 +0.5
Test Execution Time 40s 32s -8s
Details
  |                     | main (53364b4) | #7 (fb9c112) | +/-  |
  |---------------------|----------------|--------------|------|
  | Coverage            |          89.1% |        89.1% | 0.0% |
  |   Files             |              2 |            2 |    0 |
  |   Lines             |             37 |           37 |    0 |
  |   Covered           |             33 |           33 |    0 |
+ | Code to Test Ratio  |          1:1.5 |        1:2.0 | +0.5 |
  |   Code              |            168 |          169 |   +1 |
+ |   Test              |            265 |          352 |  +87 |
+ | Test Execution Time |            40s |          32s |  -8s |

Code coverage of files in pull request scope (83.3% → 83.3%)

Files Coverage +/- Status
exec.go 83.3% 0.0% modified

Reported by octocov

@k1LoW k1LoW merged commit fa1ae1e into main Aug 14, 2025
2 checks passed
@github-actions github-actions bot mentioned this pull request Aug 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request minor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant