table driven test: skipping a test

152 views
Skip to first unread message

Manlio Perillo

unread,
Nov 13, 2015, 4:54:26 PM11/13/15
to golang-nuts
Hi.

In a table driven test suite I want to skip some tests.
Currently I'm doing:

for _, test := range lexTests {
        if strings.HasPrefix(test.name, "-") {
            // We can not use t.Skip
            t.Logf("TODO: %s", test.name[1:])

            continue
        }

        ...
}

The skipped test entry has a comment explaining why it is skipped.
Is this the best way to handle the problem?


Thanks  Manlio

Dan Kortschak

unread,
Nov 13, 2015, 6:04:55 PM11/13/15
to Manlio Perillo, golang-nuts
Currently, yes. I use bools or prefix of test names for this, but see
https://github.com/golang/proposal/blob/master/design/12166-subtests.md
Reply all
Reply to author
Forward
0 new messages