Groups
Groups
Sign in
Groups
Groups
golang-nuts
Conversations
About
Send feedback
Help
testing.T.Log do not print out the log?
2,329 views
Skip to first unread message
Hill
unread,
Apr 14, 2012, 1:37:10 AM
4/14/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to golang-nuts
I have a little program to show this, why the "Test" is not showed on
the
console? But the fmt can do this. Did I miss something?
d:/Code/testinglog $ cat log_test.go
package main
import (
"testing"
"fmt"
)
func TestXxx(t *testing.T){
t.Log("Test")
fmt.Println("Test2")
}
d:/Code/testinglog $ go test
Test2
PASS
ok _/d_/Code/testinglog 0.276s
Dave Cheney
unread,
Apr 14, 2012, 1:46:59 AM
4/14/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Hill, golang-nuts
go test -v
Is what you are looking for.
Cheers
Dave
Stephen Weinberg
unread,
Apr 14, 2012, 1:52:09 AM
4/14/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to golang-nuts
Why print a log if there was no error? It is just adding noise to what
should be "it worked".
If you don't agree, just run go test with the -v flag.
-- Stephen
Hill
unread,
Apr 14, 2012, 2:05:33 AM
4/14/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to golang-nuts
Thanks. This is what I want.
I found more info can be get from : go help testflag
Hill
unread,
Apr 14, 2012, 2:07:06 AM
4/14/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to golang-nuts
Thanks for the advice. I was just doing a rough test, to print out a
string.
Reply all
Reply to author
Forward
0 new messages