MCPcopy
hub / github.com/stretchr/testify / TestCopyExportedFields

Function TestCopyExportedFields

assert/assertions_test.go:286–373  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

284}
285
286func TestCopyExportedFields(t *testing.T) {
287 t.Parallel()
288
289 intValue := 1
290
291 cases := []struct {
292 input interface{}
293 expected interface{}
294 }{
295 {
296 input: Nested{"a", "b"},
297 expected: Nested{"a", nil},
298 },
299 {
300 input: Nested{&intValue, 2},
301 expected: Nested{&intValue, nil},
302 },
303 {
304 input: Nested{nil, 3},
305 expected: Nested{nil, nil},
306 },
307 {
308 input: S{1, Nested{2, 3}, 4, Nested{5, 6}},
309 expected: S{1, Nested{2, nil}, nil, Nested{}},
310 },
311 {
312 input: S3{},
313 expected: S3{},
314 },
315 {
316 input: S3{&Nested{1, 2}, &Nested{3, 4}},
317 expected: S3{&Nested{1, nil}, &Nested{3, nil}},
318 },
319 {
320 input: S3{Exported1: &Nested{"a", "b"}},
321 expected: S3{Exported1: &Nested{"a", nil}},
322 },
323 {
324 input: S4{[]*Nested{
325 nil,
326 {1, 2},
327 }},
328 expected: S4{[]*Nested{
329 nil,
330 {1, nil},
331 }},
332 },
333 {
334 input: S4{
335 []*Nested{
336 {1, 2},
337 },
338 },
339 expected: S4{
340 []*Nested{
341 {1, nil},
342 },
343 },

Callers

nothing calls this directly

Calls 4

copyExportedFieldsFunction · 0.85
ObjectsAreEqualValuesFunction · 0.85
ErrorfMethod · 0.65
RunMethod · 0.45

Tested by

no test coverage detected