MCPcopy Index your code
hub / github.com/dropbox/godropbox / TestStackTrace

Function TestStackTrace

errors/errors_test.go:15–37  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

13)
14
15func TestStackTrace(t *testing.T) {
16 const testMsg = "test error"
17 er := New(testMsg)
18
19 if er.GetMessage() != testMsg {
20 t.Errorf("error message %s != expected %s", er.GetMessage(), testMsg)
21 }
22
23 if strings.Index(er.GetStack(), "github.com/dropbox/godropbox/errors/errors.go") != -1 {
24 t.Error("stack trace generation code should not be in the error stack trace")
25 }
26
27 if strings.Index(er.GetStack(), "TestStackTrace") == -1 {
28 t.Error("stack trace must have test code in it")
29 }
30
31 for i, r := range er.GetStack() {
32 if !(unicode.IsSpace(r) || unicode.IsPrint(r)) {
33 t.Errorf("stack trace has an unexpected rune at index %v (%q)", i, r)
34 break
35 }
36 }
37}
38
39func TestWrappedError(t *testing.T) {
40 const (

Callers

nothing calls this directly

Calls 4

NewFunction · 0.70
GetMessageMethod · 0.65
GetStackMethod · 0.65
ErrorMethod · 0.65

Tested by

no test coverage detected