Skip to content

Test runner: expect-stdout lines are matched as substrings of the whole output (no order, no count, no line boundary) #1855

Closed

Description

@ehartford

Tool defect: //! expect-stdout: checks each line as a substring of the whole stdout

src/main.w test_validate_output (at 725478e0: lines 4085-4091) passes when actual.contains(expected) for each expected line:

  • Order is never checked.
  • Line boundaries are never checked, so drop 1 is satisfied by drop 10 or undrop 1x.
  • Count is never checked: a line printed twice, which is what a double drop looks like, still passes.

This matters because behavior tests pin drop order and drop-exactly-once by listing lines. Found while fixing #1851: a test whose drops printed after end passed on the unfixed compiler. The #1847 and #1854 behavior tests list drop N lines in order and do not pin what they claim. Their follow-up rewrites them as one trace line, which the substring rule does check exactly.

Proposed rule

The expect-stdout lines, in order, are the program's stdout lines (or a contiguous run of them). Tests that want "contains" semantics already exist; they would need an explicit directive such as expect-stdout-contains:. Any change of the default has to sweep the whole corpus first: 2307 expect-stdout directives under test/behavior alone.

Filed per "a tool that stayed silent is a bug".

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions