Package list golang-github-imdario-mergo / 8fbe67a4-cda9-44e9-9dd7-051ce783f180/main issue17_test.go
8fbe67a4-cda9-44e9-9dd7-051ce783f180/main

Tree @8fbe67a4-cda9-44e9-9dd7-051ce783f180/main (Download .tar.gz)

issue17_test.go @8fbe67a4-cda9-44e9-9dd7-051ce783f180/main

d415265
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6720d30
d415265
 
6720d30
d415265
 
package mergo

import (
	"encoding/json"
	"testing"
)

var (
	request    = `{"timestamp":null, "name": "foo"}`
	maprequest = map[string]interface{}{
		"timestamp": nil,
		"name":      "foo",
		"newStuff":  "foo",
	}
)

func TestIssue17MergeWithOverwrite(t *testing.T) {
	var something map[string]interface{}
	if err := json.Unmarshal([]byte(request), &something); err != nil {
		t.Errorf("Error while Unmarshalling maprequest: %s", err)
	}
	if err := MergeWithOverwrite(&something, maprequest); err != nil {
		t.Errorf("Error while merging: %s", err)
	}
}