MCPcopy Index your code
hub / github.com/expr-lang/expr / addIntFormatterTests

Function addIntFormatterTests

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

Source from the content-addressed store, hash-verified

93}
94
95func addIntFormatterTests() {
96 // Max int8.
97 v := int8(127)
98 nv := (*int8)(nil)
99 pv := &v
100 vAddr := fmt.Sprintf("%p", pv)
101 pvAddr := fmt.Sprintf("%p", &pv)
102 vt := "int8"
103 vs := "127"
104 addFormatterTest("%v", v, vs)
105 addFormatterTest("%v", pv, "<*>"+vs)
106 addFormatterTest("%v", &pv, "<**>"+vs)
107 addFormatterTest("%v", nv, "<nil>")
108 addFormatterTest("%+v", v, vs)
109 addFormatterTest("%+v", pv, "<*>("+vAddr+")"+vs)
110 addFormatterTest("%+v", &pv, "<**>("+pvAddr+"->"+vAddr+")"+vs)
111 addFormatterTest("%+v", nv, "<nil>")
112 addFormatterTest("%#v", v, "("+vt+")"+vs)
113 addFormatterTest("%#v", pv, "(*"+vt+")"+vs)
114 addFormatterTest("%#v", &pv, "(**"+vt+")"+vs)
115 addFormatterTest("%#v", nv, "(*"+vt+")"+"<nil>")
116 addFormatterTest("%#+v", v, "("+vt+")"+vs)
117 addFormatterTest("%#+v", pv, "(*"+vt+")("+vAddr+")"+vs)
118 addFormatterTest("%#+v", &pv, "(**"+vt+")("+pvAddr+"->"+vAddr+")"+vs)
119 addFormatterTest("%#+v", nv, "(*"+vt+")"+"<nil>")
120
121 // Max int16.
122 v2 := int16(32767)
123 nv2 := (*int16)(nil)
124 pv2 := &v2
125 v2Addr := fmt.Sprintf("%p", pv2)
126 pv2Addr := fmt.Sprintf("%p", &pv2)
127 v2t := "int16"
128 v2s := "32767"
129 addFormatterTest("%v", v2, v2s)
130 addFormatterTest("%v", pv2, "<*>"+v2s)
131 addFormatterTest("%v", &pv2, "<**>"+v2s)
132 addFormatterTest("%v", nv2, "<nil>")
133 addFormatterTest("%+v", v2, v2s)
134 addFormatterTest("%+v", pv2, "<*>("+v2Addr+")"+v2s)
135 addFormatterTest("%+v", &pv2, "<**>("+pv2Addr+"->"+v2Addr+")"+v2s)
136 addFormatterTest("%+v", nv2, "<nil>")
137 addFormatterTest("%#v", v2, "("+v2t+")"+v2s)
138 addFormatterTest("%#v", pv2, "(*"+v2t+")"+v2s)
139 addFormatterTest("%#v", &pv2, "(**"+v2t+")"+v2s)
140 addFormatterTest("%#v", nv2, "(*"+v2t+")"+"<nil>")
141 addFormatterTest("%#+v", v2, "("+v2t+")"+v2s)
142 addFormatterTest("%#+v", pv2, "(*"+v2t+")("+v2Addr+")"+v2s)
143 addFormatterTest("%#+v", &pv2, "(**"+v2t+")("+pv2Addr+"->"+v2Addr+")"+v2s)
144 addFormatterTest("%#+v", nv2, "(*"+v2t+")"+"<nil>")
145
146 // Max int32.
147 v3 := int32(2147483647)
148 nv3 := (*int32)(nil)
149 pv3 := &v3
150 v3Addr := fmt.Sprintf("%p", pv3)
151 pv3Addr := fmt.Sprintf("%p", &pv3)
152 v3t := "int32"

Callers 1

TestFormatterFunction · 0.85

Calls 2

addFormatterTestFunction · 0.85
SprintfMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…