MCPcopy Index your code
hub / github.com/tinode/chat / TestMergeInterfaces

Function TestMergeInterfaces

server/utils_test.go:400–475  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

398 }
399}
400func TestMergeInterfaces(t *testing.T) {
401 cases := []struct {
402 dst any
403 src any
404 expected any
405 changed bool
406 }{
407 {
408 dst: map[string]any{"a": 1, "b": map[string]any{"x": 1}},
409 src: map[string]any{"b": map[string]any{"y": 2}},
410 expected: map[string]any{"a": 1, "b": map[string]any{"x": 1, "y": 2}},
411 changed: true,
412 },
413 {
414 dst: map[string]any{"a": 1, "b": map[string]any{"x": 1}},
415 src: map[string]any{"b": map[string]any{"x": nullValue}},
416 expected: map[string]any{"a": 1, "b": map[string]any{}},
417 changed: true,
418 },
419 {
420 dst: map[string]any{"a": 1},
421 src: nullValue,
422 expected: nil,
423 changed: true,
424 },
425 {
426 dst: "old string",
427 src: "new string",
428 expected: "new string",
429 changed: true,
430 },
431 {
432 dst: "old string",
433 src: 12345,
434 expected: 12345,
435 changed: true,
436 },
437 {
438 dst: "old string",
439 src: nullValue,
440 expected: nil,
441 changed: true,
442 },
443 {
444 dst: 123,
445 src: 456,
446 expected: 456,
447 changed: true,
448 },
449 {
450 dst: 123,
451 src: nil,
452 expected: 123,
453 changed: false,
454 },
455 {
456 dst: 123,
457 src: true,

Callers

nothing calls this directly

Calls 1

mergeInterfacesFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…