MCPcopy Create free account
hub / github.com/expr-lang/expr / addErrorFormatterTests

Function addErrorFormatterTests

internal/spew/format_test.go:1397–1422  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1395}
1396
1397func addErrorFormatterTests() {
1398 // Type that has a custom Error interface.
1399 v := customError(127)
1400 nv := (*customError)(nil)
1401 pv := &v
1402 vAddr := fmt.Sprintf("%p", pv)
1403 pvAddr := fmt.Sprintf("%p", &pv)
1404 vt := "spew_test.customError"
1405 vs := "error: 127"
1406 addFormatterTest("%v", v, vs)
1407 addFormatterTest("%v", pv, "<*>"+vs)
1408 addFormatterTest("%v", &pv, "<**>"+vs)
1409 addFormatterTest("%v", nv, "<nil>")
1410 addFormatterTest("%+v", v, vs)
1411 addFormatterTest("%+v", pv, "<*>("+vAddr+")"+vs)
1412 addFormatterTest("%+v", &pv, "<**>("+pvAddr+"->"+vAddr+")"+vs)
1413 addFormatterTest("%+v", nv, "<nil>")
1414 addFormatterTest("%#v", v, "("+vt+")"+vs)
1415 addFormatterTest("%#v", pv, "(*"+vt+")"+vs)
1416 addFormatterTest("%#v", &pv, "(**"+vt+")"+vs)
1417 addFormatterTest("%#v", nv, "(*"+vt+")"+"<nil>")
1418 addFormatterTest("%#+v", v, "("+vt+")"+vs)
1419 addFormatterTest("%#+v", pv, "(*"+vt+")("+vAddr+")"+vs)
1420 addFormatterTest("%#+v", &pv, "(**"+vt+")("+pvAddr+"->"+vAddr+")"+vs)
1421 addFormatterTest("%#+v", nv, "(*"+vt+")"+"<nil>")
1422}
1423
1424func addPassthroughFormatterTests() {
1425 // %x passthrough with uint.

Callers 1

TestFormatterFunction · 0.85

Calls 3

addFormatterTestFunction · 0.85
SprintfMethod · 0.80
customErrorTypeAlias · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…