Skip to content

Migrate return and loop tests from Rust to Ruby integration tests#70

Merged
dak2 merged 1 commit intomainfrom
migrate-returns-loops-tests-to-ruby
Mar 20, 2026
Merged

Migrate return and loop tests from Rust to Ruby integration tests#70
dak2 merged 1 commit intomainfrom
migrate-returns-loops-tests-to-ruby

Conversation

@dak2
Copy link
Copy Markdown
Owner

@dak2 dak2 commented Mar 20, 2026

Motivation

Rust-side tests in returns.rs and loops.rs were full-pipeline integration tests (parse → install → propagate → run_all) that duplicated coverage already provided by Ruby integration tests. This creates maintenance burden and obscures the boundary between unit tests and integration tests.

Rust tests should only verify internal state not accessible via CLI, while end-to-end type inference results should be validated by Ruby integration tests.

Changes

Rust (removals)

  • returns.rs: Remove all 7 tests (entire #[cfg(test)] module) — all were REDUNDANT with return_test.rb or UNIQUE scenarios now migrated to Ruby
  • loops.rs: Remove 7 tests and unused helper get_type_show — keep 3 UNIT tests:
    • test_while_variable_assignment_in_body (variable assignment smoke test)
    • test_for_variable_type_from_array (type inference verification)
    • test_for_variable_persists_after_loop (Ruby scope semantics verification)

Ruby (additions)

  • return_test.rb: Add test_return_dead_code_over_approximation — verifies union type for dead code after return
  • loop_test.rb: Add 3 tests:
    • test_while_modifier_form_no_error — while modifier syntax
    • test_begin_end_while_no_error — begin-end-while loop
    • test_for_empty_body_no_error — for loop with empty body

Checked

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

🤖 Generated with Claude Code

Rust-side tests in returns.rs and loops.rs were full-pipeline integration
tests (parse → install → propagate → run_all) that duplicated coverage
already provided by Ruby integration tests. This PR moves UNIQUE scenarios
to Ruby and removes REDUNDANT Rust tests, keeping only true unit tests
that verify internal state not accessible via CLI.

returns.rs: remove all 7 tests (all REDUNDANT or UNIQUE now in Ruby)
loops.rs: remove 7 tests, keep 3 UNIT tests (variable assignment,
  for-variable type inference, for-variable scope persistence)

Ruby additions:
- return_test.rb: dead code over-approximation test
- loop_test.rb: while modifier form, begin-end-while, for empty body

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@dak2 dak2 force-pushed the migrate-returns-loops-tests-to-ruby branch from eeaebc2 to 8aee4d7 Compare March 20, 2026 09:27
@dak2 dak2 merged commit e2b5297 into main Mar 20, 2026
4 checks passed
@dak2 dak2 deleted the migrate-returns-loops-tests-to-ruby branch March 20, 2026 09:34
@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