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
Closed

testing: Suggest add TB.Print for raw message #8783

chai2010 opened this issue Sep 20, 2014 · 1 comment

Comments

@chai2010
Copy link
Contributor

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
Copy link
Contributor

Comment 1:

Status changed to Duplicate.

Merged into issue #4899.

@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.
Projects
None yet
Development

No branches or pull requests

3 participants