rfc: add testing.Skip{,f}

88 views
Skip to first unread message

Dave Cheney

unread,
Jan 20, 2013, 8:26:25 PM1/20/13
to golang-nuts
Hello,

I have had the following patch knocking about in my tree for a few
months now. In the current stdlib there are 97 occurrences of the
`skip` pattern, ie, if x { t.Logf("skippng because x"} ; return }

% find pkg -name '*_test.go' | xargs egrep 't.Log.*kip' | wc -l
97

Would something like the following be an acceptable addition to the
testing package ?

https://codereview.appspot.com/6501094

In terms of LoC savings this isn't a lot, although you do get a record
of which tests were skipped rather than pass without testing anything.
You can also skip a test anywhere that has access to a *testing.T,
which is something I have found lacking currently with tests that have
a setup phase.

Cheers

Dave

minux

unread,
Jan 20, 2013, 8:35:54 PM1/20/13
to Dave Cheney, golang-nuts
I like this proposal.

Andrew Gerrand

unread,
Jan 20, 2013, 8:43:52 PM1/20/13
to minux, Dave Cheney, golang-nuts
I agree.
Reply all
Reply to author
Forward
0 new messages