Skip to content

Migrate exception handling tests from Rust to Ruby integration tests#71

Merged
dak2 merged 1 commit into
mainfrom
migrate-exception-tests-to-ruby
Mar 20, 2026
Merged

Migrate exception handling tests from Rust to Ruby integration tests#71
dak2 merged 1 commit into
mainfrom
migrate-exception-tests-to-ruby

Conversation

@dak2

@dak2 dak2 commented Mar 20, 2026

Copy link
Copy Markdown
Owner

Motivation

The Rust exception tests in exceptions.rs were largely full-pipeline integration tests (parse → install → propagate → run_all) that duplicated coverage already provided by Ruby integration tests in test/exception_test.rb. This is part of the ongoing effort to consolidate integration-level testing in the Ruby test suite and keep only true unit tests on the Rust side.

Changes

Rust side (core/src/analyzer/exceptions.rs):

  • Removed 15 redundant integration tests that are already covered by Ruby tests
  • Kept 2 true unit tests (test_rescue_variable_scope_restore, test_rescue_variable_scope_removal) that verify internal scope state not accessible via CLI

Ruby side (test/exception_test.rb):

  • Added 6 unique test scenarios previously only covered in Rust:
    • test_nested_begin_rescue_union_type — nested begin/rescue returns union of all branches
    • test_begin_ensure_only_no_false_positive — begin/ensure without rescue produces no false positive
    • test_rescue_modifier_same_type_dedup — rescue modifier with same type deduplicates
    • test_ensure_side_effects_no_false_positive — ensure block side effects don't cause false positives
    • test_rescue_qualified_exception_class — qualified exception class (Net::HTTPError) is handled
    • test_empty_rescue_body_returns_nil — empty rescue body infers nil type

Checked

  • cd core && cargo test --lib — all Rust tests pass
  • bundle exec rake test — all Ruby tests pass

🤖 Generated with Claude Code

The Rust exception tests in exceptions.rs were largely full-pipeline
integration tests (parse → install → propagate → run_all) that
duplicated coverage already provided by Ruby integration tests in
test/exception_test.rb.

Remove 15 redundant Rust tests and keep only the 2 true unit tests
that verify internal scope state (rescue_variable_scope_restore and
rescue_variable_scope_removal), which cannot be validated through
the CLI.

Add 6 unique test scenarios to Ruby side that were previously only
covered in Rust:
- nested begin/rescue union type
- begin/ensure without rescue
- rescue modifier same type dedup
- ensure side effects
- rescue qualified exception class (Net::HTTPError)
- empty rescue body returns nil

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@dak2 dak2 merged commit e4e8297 into main Mar 20, 2026
4 checks passed
@dak2 dak2 deleted the migrate-exception-tests-to-ruby branch March 20, 2026 09:57
@dak2 dak2 mentioned this pull request Mar 24, 2026
2 tasks
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