-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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: panic during Example function omits stack trace #2691
Labels
Milestone
Comments
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? Status changed to WaitingForReply. |
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 functions |
Labels changed: added priority-go1, removed priority-triage. Owner changed to @adg. Status changed to Accepted. |
Owner changed to builder@golang.org. |
This issue was closed by revision d888ab8. Status changed to Fixed. |
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
by raul.san@sent.com:
The text was updated successfully, but these errors were encountered: