Skip to content

Commit d8e35a4

Browse files
committed
Add T.Skip(count int, description string)
The spec [1] suggests "ok 23 # SKIP ...", but if you attempt this with: t.Pass("# SKIP foo") you get an extra hyphen ("ok 23 - # SKIP foo") which is parsed as a successful test (and not a skipped test). Michael gives the following example to motivate 'count' [2]: if ConditionIsMet() { t.Ok(Foo(), "foo") t.Ok(Bar(), "bar") } else { t.Skip(2, "condition not met") } The spec example of this is in [3], showing no special syntax for skipping multiple tests (although there is a special syntax for skipping *all* the tests). Also alphabetize TESTS in the Makefile. [1]: http://testanything.org/tap-version-13-specification.html#skipping-tests [2]: mndrix/tap-go#6 (comment) [3]: http://testanything.org/tap-version-13-specification.html#skipping-a-few
1 parent a63e479 commit d8e35a4

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

util/tap.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,14 @@ func escapeNewlines(s string) string {
117117
return strings.Replace(strings.TrimRight(s, "\n"), "\n", "\n# ", -1)
118118
}
119119

120+
// Skip indicates that a test has been skipped.
121+
func (t *T) Skip(count int, description string) {
122+
for i := 0; i < count; i++ {
123+
t.printf("ok %d # SKIP %s\n", t.nextTestNumber, description)
124+
t.nextTestNumber++
125+
}
126+
}
127+
120128
// Diagnostic generates a diagnostic from the message,
121129
// which may span multiple lines.
122130
func (t *T) Diagnostic(message string) {

0 commit comments

Comments
 (0)