MCPcopy
hub / github.com/expr-lang/expr / TestCopyExportedFields

Function TestCopyExportedFields

internal/testify/assert/assertions_test.go:285–366  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 4

copyExportedFieldsFunction · 0.85
ObjectsAreEqualValuesFunction · 0.85
RunMethod · 0.80
ErrorfMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…