Skip to main content

Preserve-Breaks Regression Tests

Targeted fixtures pinning behavior for defects identified in the preserveBreaks research (PR #148). Every scenario here exercises preserveBreaks=breaks_and_alignment and is asserted to be N-pass idempotent.

D5 — subquery inner breaks honored despite outer inline fit

Regression guard for the idempotency-breaking "outer flat erases inner" contract violation. The subquery's SELECT list carries user breaks; even though the subquery would measure as fitting inline, the outer flat propagation must not silently drop those breaks.

select a from t where a in (select b,
c from t2)
select a
from t
where a in (
select
b,
c
from t2
)

Mixed gaps preserved exactly

The user wrote a, b,\n c, d — SAME_LINE between a/b and c/d, NEW_LINE between b/c. Preserve that exact pattern on output, don't normalize.

select a, b,
c, d from t
select
a, b,
c, d
from t

Line comment counts as a newline signal

A trailing line comment between items implicitly carries a newline, which expands the list. Pinned behavior (research Q2): intentional.

select a, -- note
b, c from t
select
a,

-- note
b, c
from t

Blank line between items becomes a section break

Double-newline between items is preserved as a BLANK_LINE gap.

select a,

b,
c from t
select
a,

b,
c
from t

Inline block comment without newline does not force vertical

A /* ... */ with no newline inside does not count as a separator-newline signal.

select a, /* note */ b, c from t
select a, /* note */ b, c from t