Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

testing: Assert(...error) #7009

lukescott opened this issue Dec 23, 2013 · 1 comment


None yet
3 participants
Copy link

commented Dec 23, 2013

I have some helper functions that do certain tests and return helpful output as en
error. To preserve helpful line numbers I have to do this every time:

if e := test.Equals(obtained, expected); e != nil {

Something like this would be helpful:

t.Assert(test.Equals(obtained, expected))

Could look something like this:

func (c *common) Assert(err ...error) {
    args := make([]error, 0, len(errs))
    for _, e := range err {
        if e != nil {
            args = append(args, e)
    if len(args) > 0 {

Or even this:

func (c *common) Assert(err error) {
    if err != nil {

This comment has been minimized.

Copy link

commented Dec 26, 2013

Comment 1:

Status changed to WorkingAsIntended.

@golang golang locked and limited conversation to collaborators Jun 25, 2016

This issue was closed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.