You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TAP version 13
# this should be a skip test, obviously
ok 1 - description # skip
# no whitespace after #, is this skipped?
ok 2 - description #skip
# no whitespace before #, is this skipped?
ok 3 - description# skip
# no whitespace anywhere, is this skipped?
ok 4 - description#skip
# no description, whitespace after
ok 5 # skip
# no description, no whitespace after
ok 6 #skip
1..6
If we already effectively require (or wish to require) whitespace surrounding the # character, then we can specify the directive parsing much more simply, because there's no way it could ever be escaped with \.
Here's what I see when I paste that into node-tap's parser and tell it to spit out TAP for what it interpreted:
$ pbpaste | node ./bin/cmd.js -t
TAP version 13
# this should be a skip test, obviously
ok 1 - description # SKIP
# no whitespace after #, is this skipped?
ok 2 - description # SKIP
# no whitespace before #, is this skipped?
ok 3 - description\# skip
# no whitespace anywhere, is this skipped?
ok 4 - description\#skip
# no description, whitespace after
ok 5 # SKIP
# no description, no whitespace after
ok 6 # SKIP
1..6
# skip: 4
Node-tap requires whitespace before the #, but not after.
TAP version 13
# this should be a skip test, obviously 🙆🏻
ok 1 - description # skip
# no whitespace after #, is this skipped? 🙅🏻
ok 2 - description #skip
# no whitespace before #, is this skipped?🙅🏻
ok 3 - description# skip
# no whitespace anywhere, is this skipped?🙅🏻
ok 4 - description#skip
# no description, whitespace after🙆🏻
ok 5 # skip
# no description, no whitespace after🙅🏻
ok 6 #skip
1..6
Just because it's simpler to tokenize/parse with a space before and after, and I think making the description optional would be fine too.
Main producers in Perl and Raku output spaces before and after.
Two consumers accept # with or without spaces before or after it, one of them (Test2::Harness) gives a warning if the space before the directive is missing (but will otherwise parse it)
tappy considers all 6 as skips and doesn't really care about the whitespace before or after.
(venv) ➜ tappy git:(main) tap skip_whitespace.tap
ssssss
----------------------------------------------------------------------
Ran 6 tests in 0.000s
OK (skipped=6)
I don't have strong feelings about this topic. If we think it would be easier to make a valid consumer by expecting more whitespace, that seems fine to me.
Thanks everyone. In the interest of "specify what we have", how does this sound:
Producers must output \s+#\s+${directive} for directives
Harnesses must not treat \\#\s*\S+ as a directive (escaped)
Harnesses must treat \s#\s+\S+ as a directive
Harnesses may treat \S#\s+\S+, \s#\S+, or \S#\S+ as a directive, but should warn that this is invalid.
I think if that's how we specify it, then everyone is compliant, and there's still some decent guidance for new consumers (they don't have to support anything other than ok 1 - name # skip, but they can if they want to).
Reacted by Matt Layman, Bruno P. Kinoshita and Leon Timmermans
Activity
isaacs commentedon Mar 11, 2022
Here's what I see when I paste that into node-tap's parser and tell it to spit out TAP for what it interpreted:
Node-tap requires whitespace before the
#, but not after.kinow commentedon Mar 12, 2022
IMO:
Just because it's simpler to tokenize/parse with a space before and after, and I think making the description optional would be fine too.
Leont commentedon Mar 12, 2022
Main producers in Perl and Raku output spaces before and after.
Two consumers accept
#with or without spaces before or after it, one of them (Test2::Harness) gives a warning if the space before the directive is missing (but will otherwise parse it)mblayman commentedon Mar 12, 2022
tappy considers all 6 as skips and doesn't really care about the whitespace before or after.
(venv) ➜ tappy git:(main) tap skip_whitespace.tap ssssss ---------------------------------------------------------------------- Ran 6 tests in 0.000s OK (skipped=6)I don't have strong feelings about this topic. If we think it would be easier to make a valid consumer by expecting more whitespace, that seems fine to me.
isaacs commentedon Mar 12, 2022
Thanks everyone. In the interest of "specify what we have", how does this sound:
\s+#\s+${directive}for directives\\#\s*\S+as a directive (escaped)\s#\s+\S+as a directive\S#\s+\S+,\s#\S+, or\S#\S+as a directive, but should warn that this is invalid.I think if that's how we specify it, then everyone is compliant, and there's still some decent guidance for new consumers (they don't have to support anything other than
ok 1 - name # skip, but they can if they want to).isaacs commentedon Mar 12, 2022
I'll try to make the language more precise than this and provide examples, of course.
TAP14: clarify space around # in directives