Skip to content

Cover the fresh-line keyword fallback in the emitter - #14

Merged
JPDuchesne merged 3 commits into
mainfrom
jpd/cover-fresh-line-keyword
Jul 24, 2026
Merged

Cover the fresh-line keyword fallback in the emitter#14
JPDuchesne merged 3 commits into
mainfrom
jpd/cover-fresh-line-keyword

Conversation

@JPDuchesne

Copy link
Copy Markdown
Contributor

Summary

  • place_keyword's fresh-line fallback (layout.place_on_fresh_line) was the only uncovered line in the emitter/layout/renderer/thunk/lowering set — the branch taken when a rescue/ensure/else keyword has no source line (or its line is already occupied) and must open a fresh line rather than ;-pack.
  • New test emits a fully synthetic def with a loc-less ensure — the exact shape RSpock's Cleanup transform produces — asserting the keyword lands on its own line and never packs.
  • lib/ast_transform/line_aligned_emitter.rb now reports zero uncovered lines.

Test plan

  • dev style + dev test green (97 tests); coverage check confirms no uncovered lines in the emitter.

Made with Cursor

place_keyword's else branch (a loc-less or displaced rescue/ensure/else
keyword opening a fresh line instead of packing) was the emitter's only
uncovered line. Pin it with a fully synthetic ensure — the shape RSpock's
Cleanup produces.

Co-authored-by: Cursor <cursoragent@cursor.com>
@codecov

codecov Bot commented Jul 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

JPDuchesne and others added 2 commits July 24, 2026 13:43
Co-authored-by: Cursor <cursoragent@cursor.com>
Emission is a pure function of the fixture, so fragment predicates
(assert_includes, index ordering, scan counts, line-index lookups) asserted
less than the tests already knew. Every deterministic emission now pins the
whole artifact with assert_equal — three source-based container tests turn
out to be byte-identical round trips and assert the source itself. Predicates
remain only where the subject is genuinely non-exact: error-message
fragments, iseq line-table membership, and runtime values.

Co-authored-by: Cursor <cursoragent@cursor.com>
@JPDuchesne
JPDuchesne merged commit 6d8a68b into main Jul 24, 2026
5 checks passed
@JPDuchesne
JPDuchesne deleted the jpd/cover-fresh-line-keyword branch July 24, 2026 18:54
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