MCPcopy
hub / github.com/git-lfs/git-lfs / TestContextOnWrappedErrors

Function TestContextOnWrappedErrors

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

Source from the content-addressed store, hash-verified

54}
55
56func TestContextOnWrappedErrors(t *testing.T) {
57 err := NewFatalError(errors.New("go error"))
58
59 SetContext(err, "foo", "bar")
60
61 if v := GetContext(err, "foo"); v != "bar" {
62 t.Error("expected to be able to use context on wrapped errors")
63 }
64
65 ctxt := Context(err)
66 if ctxt["foo"] != "bar" {
67 t.Error("expected to get the context of an error")
68 }
69
70 DelContext(err, "foo")
71
72 if v := GetContext(err, "foo"); v == "bar" {
73 t.Errorf("expected to delete from error context")
74 }
75}

Callers

nothing calls this directly

Calls 7

NewFatalErrorFunction · 0.85
SetContextFunction · 0.85
GetContextFunction · 0.85
DelContextFunction · 0.85
ContextFunction · 0.70
ErrorMethod · 0.65
ErrorfMethod · 0.65

Tested by

no test coverage detected