Skip to content

TAP: a '#' in a test name is read as a directive, so a passing test reports as skipped #1119

Closed

Description

@Chemaclass

Problem

--report-tap writes the test description verbatim, so a # in a name reaches
the consumer as a TAP directive marker. Both tests below pass:

function test_directive_lookalike() {
  bashunit::set_test_title "check # SKIP me"
  assert_same "a" "a"
}
function test_todo_lookalike() {
  bashunit::set_test_title "rename # TODO later"
  assert_same "a" "a"
}

and the report says:

TAP version 13
1..2
ok 1 - check # SKIP me
ok 2 - rename # TODO later

which any TAP parser reads as skipped and todo respectively — I checked
with a parser implementing the usual #\s*(SKIP|TODO) rule. A green test
silently disappears from the count on a CI dashboard.

Realistic names hit this: "logs # TODO remove", "skip # SKIP on CI", or a
title carrying an issue reference like "fix # SKIP flake".

Fix

TAP 13 says a description must not contain an unescaped #; escape it as \#
(and escape a literal backslash first, so \# in a name survives as itself).
The directives bashunit emits are appended after the description, so they are
unaffected.

Applies to every ok/not ok line in src/reports/tap.sh.

Activity

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

    @Chemaclass
    MemberAuthor

    Done in #1120 (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