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: file_test.go
    path of file: ./repos/tegola/cache/file
    
    the code of the file until where you have to start completion: package file_test

import (
	"fmt"
	"reflect"
	"testing"

	"github.com/go-spatial/tegola"
	"github.com/go-spatial/tegola/cache"
	"github.com/go-spatial/tegola/cache/file"
	"github.com/go-spatial/tegola/dict"
)

func TestNew(t *testing.T) {
	type tcase struct {
		config   dict.Dict
		expected *file.Cache
		err      error
	}

	fn := func(tc tcase) func(*testing.T) {
		return func(t *testing.T) {
			t.Parallel()

			output, err := file.New(tc.config)
			if err != nil {

				if tc.err != nil && err.Error() == tc.err.Error() {
					// correct error returned
					return
				}
				t.Errorf("unexpected error %v", err)
				return
			}

			if !reflect.DeepEqual(tc.expected, output) {
				t.Errorf("expected %+v got %+v", tc.expected, output)
				return
			}
		}
	}

	tests := map[string]tcase{
		"valid basepath": {
			config: map[string]interface{}{
				"basepath": "testfiles/tegola-cache",
			},
			
    
func TestSetGetPurge(t *testing.T) {
	type tcase struct {
		config   dict.Dict
		key      cache.Key
		expected []byte
	}

	fn := func(tc tcase) func(*testing.T) {
		return func(t *testing.T) {
			t.Parallel()

			fc, err := file.New(tc.config)
			if err != nil {
				t.Errorf("%v", err)
				return
			}

			// test write
			if err = fc.Set(&tc.key, tc.expected); err != nil {
				t.Errorf("write failed. err: %v", err)
				return
			}

			output, hit, err := fc.Get(&tc.key)
			if err != nil {
				t.Errorf("read failed. err: %v", err)
				return
			}
			if !hit {
				t.Errorf("read failed. should have been a hit but cache reported a miss")
				return
			}

			if !reflect.DeepEqual(output, tc.expected) {
				t.Errorf("expected %v got %v", tc.expected, output)
				return
			}

			// test purge
			if err = fc.Purge(&tc.key); err != nil {
				t.Errorf("purge failed. err: %v", err)
				return
			}
		}
	}

	tests := map[string]tcase{
		"get set purge": {
			config: map[string]interface{}{
				"basepath": "testfiles/tegola-cache",
			},
			key: cache.Key{
				Z: 0,
				X: 1,
				Y: 2,
			},
			expected: []byte{0x53, 0x69, 0x6c, 0x61, 0x73},
		},
	}

	for name, tc := range tests {
		t.Run(name, fn(tc))
	}
}