You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
testing: panic during Example function omits stack trace #2691
What you have written is correct behavior:
a test that does not call t.Error or t.Fatal is a
passing test, so TestNone is a passing test.
You have no output comment in the example to check
against, so the example just needs to build, not run.
So everything here is okay, so the test should print PASS.
Did you have something else in mind?
I added TestNone for that it does not show the warning (due to don't use a test
function). Sorry! Now, the next one is more clear:
===
import "testing"
import "fmt"
// nothing
func Example_ff() {
var a map[int][]string
a[1][10] = "foo"
fmt.Println(a[1])
}
===
$ gotest
testing: warning: no tests to run
--- FAIL: Example_ff
panic: runtime error: index out of range
gotest: "./6.out" failed: exit status 1
* * *
===
import "testing"
import "fmt"
// nothing
func TestConst(t *testing.T) {
var a map[int][]string
a[1][10] = "foo"
fmt.Println(a[1])
}
===
$ gotest
panic: runtime error: index out of range
goroutine 2 [running]:
github.com/kless/GoJscript/gojs.TestConst()
/home/neo/Pub/Projects/Go/GoJscript/gojs/gojs_test.go:27 +0x63
testing.tRunner(0xf840000c40, 0x590fe0, 0x0, 0x0)
/var/tmp/go/src/pkg/testing/testing.go:198 +0x41
created by testing.RunTests
/var/tmp/go/src/pkg/testing/testing.go:275 +0x772
goroutine 1 [chan receive]:
testing.RunTests(0x400c00, 0x590fe0, 0x100000001, 0xf84002cc01, 0x40673f, ...)
/var/tmp/go/src/pkg/testing/testing.go:276 +0x795
testing.Main(0x400c00, 0x590fe0, 0x100000001, 0x59eda8, 0x0, ...)
/var/tmp/go/src/pkg/testing/testing.go:211 +0x62
main.main()
/home/neo/Pub/Projects/Go/GoJscript/gojs/_testmain.go:29 +0x91
gotest: "./6.out" failed: exit status 2
* * *
Note: that the example functions doesn't show all error message (the stack) like is done
with the test functions
Activity
rsc commentedon Jan 12, 2012
Comment 1:
Status changed to WaitingForReply.
gopherbot commentedon Jan 12, 2012
Comment 2 by raul.san@sent.com:
I added TestNone for that it does not show the warning (due to don't use a test function). Sorry! Now, the next one is more clear: === import "testing" import "fmt" // nothing func Example_ff() { var a map[int][]string a[1][10] = "foo" fmt.Println(a[1]) } === $ gotest testing: warning: no tests to run --- FAIL: Example_ff panic: runtime error: index out of range gotest: "./6.out" failed: exit status 1 * * * === import "testing" import "fmt" // nothing func TestConst(t *testing.T) { var a map[int][]string a[1][10] = "foo" fmt.Println(a[1]) } === $ gotest panic: runtime error: index out of range goroutine 2 [running]: github.com/kless/GoJscript/gojs.TestConst() /home/neo/Pub/Projects/Go/GoJscript/gojs/gojs_test.go:27 +0x63 testing.tRunner(0xf840000c40, 0x590fe0, 0x0, 0x0) /var/tmp/go/src/pkg/testing/testing.go:198 +0x41 created by testing.RunTests /var/tmp/go/src/pkg/testing/testing.go:275 +0x772 goroutine 1 [chan receive]: testing.RunTests(0x400c00, 0x590fe0, 0x100000001, 0xf84002cc01, 0x40673f, ...) /var/tmp/go/src/pkg/testing/testing.go:276 +0x795 testing.Main(0x400c00, 0x590fe0, 0x100000001, 0x59eda8, 0x0, ...) /var/tmp/go/src/pkg/testing/testing.go:211 +0x62 main.main() /home/neo/Pub/Projects/Go/GoJscript/gojs/_testmain.go:29 +0x91 gotest: "./6.out" failed: exit status 2 * * * Note: that the example functions doesn't show all error message (the stack) like is done with the test functionsrsc commentedon Jan 12, 2012
Comment 3:
Labels changed: added priority-go1, removed priority-triage.
Owner changed to @adg.
Status changed to Accepted.
robpike commentedon Jan 13, 2012
Comment 4:
Owner changed to builder@golang.org.
robpike commentedon Jan 19, 2012
Comment 5:
This issue was closed by revision d888ab8.
Status changed to Fixed.