MCPcopy Index your code
hub / github.com/go-errors/errors / TestAs

Function TestAs

error_test.go:33–54  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

31}
32
33func TestAs(t *testing.T) {
34 var errStrIn errorString = "TestForFun"
35
36 var errStrOut errorString
37 if As(errStrIn, &errStrOut) {
38 if errStrOut != "TestForFun" {
39 t.Errorf("direct errStr value is not returned")
40 }
41 } else {
42 t.Errorf("direct errStr is not returned")
43 }
44
45 errStrOut = ""
46 err := Wrap(errStrIn, 0)
47 if As(err, &errStrOut) {
48 if errStrOut != "TestForFun" {
49 t.Errorf("wrapped errStr value is not returned")
50 }
51 } else {
52 t.Errorf("wrapped errStr is not returned")
53 }
54}
55
56func TestStackFormat(t *testing.T) {
57

Callers

nothing calls this directly

Calls 2

WrapFunction · 0.85
AsFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…