Skip to content

Migrate include, extend, attr, and super tests from Rust to Ruby#73

Merged
dak2 merged 1 commit intomainfrom
migrate-include-extend-attr-super-tests-to-ruby
Mar 20, 2026
Merged

Migrate include, extend, attr, and super tests from Rust to Ruby#73
dak2 merged 1 commit intomainfrom
migrate-include-extend-attr-super-tests-to-ruby

Conversation

@dak2
Copy link
Copy Markdown
Owner

@dak2 dak2 commented Mar 20, 2026

Motivation

Rust analyzer tests for include/extend/attr/super were full-pipeline integration tests (analyze()resolve_method() → type string comparison) that duplicated Ruby integration test coverage. This migration eliminates redundancy while ensuring all unique scenarios are preserved in the Ruby test suite.

So, I moves end-to-end type inference tests to Ruby and keeps only true unit tests in Rust that verify internal state not observable via CLI.

Changes

Ruby additions (7 new tests)

  • include_test.rb: simultaneous include A, B MRO order (A has higher priority), class's own method takes priority over included module
  • extend_test.rb: simultaneous extend A, B MRO order, def self.find takes priority over extended module
  • attr_test.rb: attr_writer :name registers setter only (no false getter)
  • super_test.rb: super() with explicit empty args, qualified superclass (class Dog < Animals::Pet)

Rust deletions (-796 lines)

  • dispatch.rs: removed 46 redundant tests covering attr_reader/writer, include, extend, inheritance, implicit self call, constant read, keyword args, and safe navigation
  • super_calls.rs: removed 6 redundant tests (retained 2 unit tests: test_super_outside_method_ignored, test_super_without_superclass_ignored)

Retained Rust unit tests

  • dispatch.rs: 6 tests verifying internal state (unassigned attr_reader vertex, super call independence, unknown module robustness, top-level fallback, constant read no false positive)
  • super_calls.rs: 2 tests verifying guard conditions (super outside method, super without superclass)

Checked

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

🤖 Generated with Claude Code

…gration tests

Rust analyzer tests for include/extend/attr/super were full-pipeline
integration tests duplicating Ruby test coverage. Move UNIQUE scenarios
to Ruby side and remove REDUNDANT Rust tests, keeping only true unit
tests that verify internal state not observable via CLI.

Ruby additions:
- include_test.rb: MRO order for simultaneous include, class method priority
- extend_test.rb: MRO order for simultaneous extend, def self.find priority
- attr_test.rb: attr_writer setter-only registration
- super_test.rb: explicit empty args super(), qualified superclass

Rust deletions:
- dispatch.rs: 46 redundant tests covering attr/include/extend/inheritance/
  implicit-self/constant-read/keyword-args/safe-navigation
- super_calls.rs: 6 redundant tests (2 unit tests retained)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@dak2 dak2 force-pushed the migrate-include-extend-attr-super-tests-to-ruby branch from b679972 to fdfa8ba Compare March 20, 2026 15:15
@dak2 dak2 merged commit 7b0ad75 into main Mar 20, 2026
4 checks passed
@dak2 dak2 deleted the migrate-include-extend-attr-super-tests-to-ruby branch March 20, 2026 15:18
@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