Skip to content

🧪 Add error handling test for YAML loading in validate_weapons.rb - #37

Merged
hahwul merged 1 commit into
mainfrom
add-yaml-validation-test-15305974614605038322
Mar 1, 2026
Merged

🧪 Add error handling test for YAML loading in validate_weapons.rb#37
hahwul merged 1 commit into
mainfrom
add-yaml-validation-test-15305974614605038322

Conversation

@hahwul

@hahwul hahwul commented Mar 1, 2026

Copy link
Copy Markdown
Owner

🎯 What: The testing gap addressed
The script scripts/validate_weapons.rb had a rescue => e block for catching YAML parsing errors when loading files from the weapons/ directory, but this behavior was untested.

📊 Coverage: What scenarios are now tested
A new test suite (test/test_validate_weapons.rb) using minitest/autorun has been added. It creates a temporary mock weapons/ directory, places a malformed YAML file inside, and executes the validation script as a subprocess. It then verifies that:

  1. The script correctly catches the Psych::SyntaxError and prints the error message (e.g., matching "did not find expected key").
  2. The script exits cleanly with a successful status code instead of crashing.

Result: The improvement in test coverage
The error-handling path for reading weapon YAML files is now covered by automated tests, ensuring regressions (such as accidentally removing the rescue block) will be caught.


PR created automatically by Jules for task 15305974614605038322 started by @hahwul

Added a Minitest test `test/test_validate_weapons.rb` to verify that
`scripts/validate_weapons.rb` correctly rescues from YAML syntax errors
when parsing files in the `weapons/` directory, rather than crashing.
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@hahwul
hahwul merged commit 61b6b31 into main Mar 1, 2026
2 checks passed
@hahwul
hahwul deleted the add-yaml-validation-test-15305974614605038322 branch March 1, 2026 01:55
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.

1 participant