diff options
Diffstat (limited to 'cache')
| -rw-r--r-- | cache/cache_test.go | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/cache/cache_test.go b/cache/cache_test.go index 5f6a501..8753ad6 100644 --- a/cache/cache_test.go +++ b/cache/cache_test.go @@ -3,12 +3,13 @@ package cache import ( - . "github.com/ewy1/pik/runner" - "github.com/stretchr/testify/assert" "path/filepath" "strings" "testing" "testing/fstest" + + . "github.com/ewy1/pik/runner" + "github.com/stretchr/testify/assert" ) func TestLoadFile(t *testing.T) { @@ -34,7 +35,7 @@ func TestLoadFile(t *testing.T) { } func TestFromReader_Blank(t *testing.T) { - input := ` + input := ` ` sr := strings.NewReader(input) c, err := Unmarshal(sr) @@ -183,3 +184,23 @@ func TestSaveFile(t *testing.T) { err := SaveFile(loc, c) assert.NoError(t, err) } + +func TestMergeEmptyNil(t *testing.T) { + empty := &Cache{} + empty.Merge(nil) +} + +func TestMergeNormalNil(t *testing.T) { + c := &Cache{ + Entries: []Entry{{Path: "123", Label: "/asdf"}}, + } + c.Merge(nil) +} + +func TestMergeNilNormal(t *testing.T) { + var e *Cache = nil + c := &Cache{ + Entries: []Entry{{Path: "123", Label: "/asdf"}}, + } + _ = e.Merge(c) +} |
