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: Suggest add TB.Print for raw message #8783

Closed
chai2010 opened this issue Sep 20, 2014 · 1 comment

Comments

Projects
None yet
3 participants
@chai2010
Copy link
Contributor

commented Sep 20, 2014

Like this:

func TestBar(t *testing.T) {
    assert(t, false, "Bar")
}

func TestFoo(t *testing.T) {
    assert(t, false, "Foo")
}

func assert(t *testing.T, condition bool, message string) {
    if !condition {
        file, line := callerFileLine()
        t.Fatalf("%s:%d: %s", file, line, message)
    }
}

func callerFileLine() (file string, line int) {
    ...
}

We need print the `assert` file/line, not the `t.Fatalf` file/line.

http://play.golang.org/p/VPpB0NA8on
@davecheney

This comment has been minimized.

Copy link
Contributor

commented Sep 21, 2014

Comment 1:

Status changed to Duplicate.

Merged into issue #4899.

@chai2010 chai2010 added the duplicate label Sep 21, 2014

@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.