From 8e415ead76bf73f7d1d74bff0b5230917ba7b209 Mon Sep 17 00:00:00 2001 From: potsables Date: Tue, 11 Dec 2018 11:28:28 -0800 Subject: [PATCH 1/2] test: add test for patch link create == false --- shell_test.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/shell_test.go b/shell_test.go index 6b89eb9dd..1cf362b30 100644 --- a/shell_test.go +++ b/shell_test.go @@ -223,10 +223,12 @@ func TestPatch_rmLink(t *testing.T) { func TestPatchLink(t *testing.T) { is := is.New(t) s := NewShell(shellUrl) - newRoot, err := s.PatchLink(examplesHash, "about", "QmUXTtySmd7LD4p6RG6rZW6RuUuPZXTtNMmRQ6DSQo3aMw", true) is.Nil(err) is.Equal(newRoot, "QmVfe7gesXf4t9JzWePqqib8QSifC1ypRBGeJHitSnF7fA") + newRoot, err = s.PatchLink(examplesHash, "about", "QmUXTtySmd7LD4p6RG6rZW6RuUuPZXTtNMmRQ6DSQo3aMw", false) + is.Nil(err) + is.Equal(newRoot, "QmVfe7gesXf4t9JzWePqqib8QSifC1ypRBGeJHitSnF7fA") } func TestResolvePath(t *testing.T) { From 72217c1e849b4ee0722b6a569259c38ff3908a74 Mon Sep 17 00:00:00 2001 From: potsables Date: Tue, 11 Dec 2018 12:37:34 -0800 Subject: [PATCH 2/2] shell: added more comprehensive patch::add-link tests --- shell_test.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/shell_test.go b/shell_test.go index 1cf362b30..0586d1ebc 100644 --- a/shell_test.go +++ b/shell_test.go @@ -229,6 +229,13 @@ func TestPatchLink(t *testing.T) { newRoot, err = s.PatchLink(examplesHash, "about", "QmUXTtySmd7LD4p6RG6rZW6RuUuPZXTtNMmRQ6DSQo3aMw", false) is.Nil(err) is.Equal(newRoot, "QmVfe7gesXf4t9JzWePqqib8QSifC1ypRBGeJHitSnF7fA") + newHash, err := s.NewObject("unixfs-dir") + is.Nil(err) + _, err = s.PatchLink(newHash, "a/b/c", newHash, false) + is.NotNil(err) + newHash, err = s.PatchLink(newHash, "a/b/c", newHash, true) + is.Nil(err) + is.Equal(newHash, "QmQ5D3xbMWFQRC9BKqbvnSnHri31GqvtWG1G6rE8xAZf1J") } func TestResolvePath(t *testing.T) {