You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: jsonpath_test.go
    path of file: ./repos/erda/pkg/encoding/jsonpath
    
    the code of the file until where you have to start completion: // Copyright (c) 2021 Terminus, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package jsonpath

import (
	"encoding/json"
	"reflect"
	"testing"
)

var data = map[string]interface{}{
	"user": map[string]interface{}{
		"firstname": "seth",
		"lastname":  "rogen",
	},
	"age": 35,
	"filmography": map[string]interface{}{
		"movies": []string{
			"This Is The End",
			"Superbad",
			"Neighbors",
		},
	},
}

func TestGet(t *testing.T) {
	result, err := Get(data, "user.firstname")
	if err != nil {
		t.Errorf("failed to get user.fi
    
func TestJSON(t *testing.T) {
	test := `
{
	"pet": {
		"name": "baxter",
		"owner": {
      "name": "john doe",
      "contact": {
			  "phone": "859-289-9290"
      }
		},
		"type": "dog",
    "age": "4"
	},
	"tags": [
		12,
		true,
		{
			"hello": [
				"world"
			]
		}
	]
}
`
	var payload interface{}

	err := json.Unmarshal([]byte(test), &payload)
	if err != nil {
		t.Errorf("failed to parse: %v", err)
	}

	result, err := Get(payload, "tags[2].hello[0]")
	if result != "world" {
		t.Errorf("got wrong value from path, wanted: %v, got: %v", "world", result)
	}

	err = Set(&payload, "tags[2].hello[0]", "bobby")
	if err != nil {
		t.Errorf("failed to set: %v", err)
	}

	result, err = Get(payload, "tags[2].hello[0]")
	if result != "bobby" {
		t.Errorf("got wrong value after setting, wanted: %v, got: %v", "bobby", result)
	}

	newContact := map[string]string{
		"phone": "555-555-5555",
		"email": "baxterowner@johndoe.com",
	}
	err = Set(&payload, "pet.owner.contact", newContact)
	if err != nil {
		t.Errorf("failed to set: %v", err)
	}

	contact, err := Get(&payload, "pet.owner.contact")
	if !reflect.DeepEqual(newContact, contact) {
		t.Errorf("contact set do not equal, wanted: %v, got %v", newContact, contact)
	}

	small := `{}`

	err = json.Unmarshal([]byte(small), &payload)
	if err != nil {
		t.Errorf("failed to parse: %v", err)
	}

	err = Set(&payload, "this.is.new[3]", map[string]interface{}{
		"hello": "world",
	})
	if err != nil {
		t.Errorf("setting a nonexistant field did not work well, %v", err)
	}

	b, err := json.Marshal(payload)
	output := string(b)
	expected := `{"this":{"is":{"new":[null,null,null,{"hello":"world"}]}}}`
	if output != expected {
		t.Errorf("did not set correctly, wanted: %v, got: %v", expected, output)
	}
}