Skip to content

--output tap does not escape # in a test description, so a failing test can be read as skipped #1309

Closed

Description

@Chemaclass

🤔 Background

TAP 13 reads an unescaped # on a test line as the start of a directive. --output tap interpolates the description raw, so a title containing one hands the consumer a directive bashunit never meant.

The dangerous direction is a failing test:

function test_titled() {
  bashunit::set_test_title "validates input # SKIP unsupported"
  assert_same "expected" "actual"
}
not ok 1 - validates input # SKIP unsupported

A TAP consumer parses that as result not ok, description validates input, directive SKIP unsupported — and a not ok carrying a SKIP directive is not a failure. The failure leaves CI silently. # TODO does the same to a passing test.

💡 Cause

There are two TAP emitters, and only one escapes.

bashunit::reports::__tap_description (src/reports/tap.sh) was written for exactly this, for #1119 — its comment even names the case — including the [#] workaround for Bash 3.0 reading a bare # after // as anchor-to-start. It is used by the --report-tap file writer.

The --output tap stream is written by src/console/line.sh instead, and never calls it:

$ ... --report-tap r.tap   ->  not ok 1 - validates input \# SKIP unsupported
$ ... --output tap         ->  not ok 1 - validates input # SKIP unsupported

Applying the existing helper to the description in console/line.sh closes it. Only the description: the # SKIP / # TODO / # snapshot / # RISKY directives those lines append are bashunit's own and must stay literal.

💡 Found by

Continuing the report-writer sweep from #1305/#1307 into TAP.

Activity

  1. self-assigned this
    on Aug 17, 2026
  2. Chemaclass commented on Aug 17, 2026

    @Chemaclass
    MemberAuthor

    Fixed in #1310 (merged).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

  • Status
    Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions