Skip to content

Fix test naming convention in agents, terminal, editor#610

Merged
Wirasm merged 3 commits into
mainfrom
kild/refactor/fix-test-naming
Feb 26, 2026
Merged

Fix test naming convention in agents, terminal, editor#610
Wirasm merged 3 commits into
mainfrom
kild/refactor/fix-test-naming

Conversation

@Wirasm

@Wirasm Wirasm commented Feb 26, 2026

Copy link
Copy Markdown
Owner

Summary

  • Updated define_agent_backend! macro to generate test names following <subject>_<expected_behavior> convention (e.g. amp_backend_returns_correct_name instead of test_name) using paste crate for identifier concatenation
  • Renamed three trait test functions (test_*_backend_basic_methods → descriptive behavioral names) in agents/traits.rs, terminal/traits.rs, editor/traits.rs

Test plan

  • All 36 affected tests pass with new names
  • cargo fmt --check clean
  • cargo clippy --all -- -D warnings clean

Closes #523

Update `define_agent_backend!` macro to generate test names that follow
the `<subject>_<expected_behavior>` convention using `paste` for ident
concatenation (e.g. `amp_backend_returns_correct_name`).

Rename trait test functions:
- `test_agent_backend_basic_methods` → `mock_agent_backend_delegates_name_display_and_yolo_correctly`
- `test_terminal_backend_basic_methods` → `mock_terminal_backend_name_and_availability_are_accessible`
- `test_editor_backend_basic_methods` → `mock_editor_backend_is_available_and_not_a_terminal_editor`

Closes #523
Move `paste` from production to dev/test section in workspace Cargo.toml
to match `temp-env` placement convention.

Rename remaining sibling tests that were missed in the initial pass:
- test_terminal_backend_execute_spawn → mock_terminal_backend_execute_spawn_returns_window_title
- test_terminal_backend_close_window → mock_terminal_backend_close_window_does_not_panic
- test_editor_backend_open → mock_editor_backend_open_succeeds
Address review agent findings:
- Extract 4 shared test functions into define_agent_backend_tests! helper
  macro, eliminating ~30 lines of duplication between the two arms
- Update module doc comment to reflect the new test_prefix parameter
- Trim redundant return-type clause from terminal close_window test comment
@Wirasm Wirasm merged commit 537ae67 into main Feb 26, 2026
6 checks passed
@Wirasm Wirasm deleted the kild/refactor/fix-test-naming branch February 26, 2026 23:25
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.

refactor: fix test naming convention violations in agents/, terminal/, editor/ traits

1 participant