aboutsummaryrefslogtreecommitdiffstats
path: root/utils/merkletrie/filesystem/node_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'utils/merkletrie/filesystem/node_test.go')
-rw-r--r--utils/merkletrie/filesystem/node_test.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/utils/merkletrie/filesystem/node_test.go b/utils/merkletrie/filesystem/node_test.go
index a383716..bf1178a 100644
--- a/utils/merkletrie/filesystem/node_test.go
+++ b/utils/merkletrie/filesystem/node_test.go
@@ -25,11 +25,13 @@ func (s *NoderSuite) TestDiff(c *C) {
WriteFile(fsA, "foo", []byte("foo"), 0644)
WriteFile(fsA, "qux/bar", []byte("foo"), 0644)
WriteFile(fsA, "qux/qux", []byte("foo"), 0644)
+ fsA.Symlink("foo", "bar")
fsB := memfs.New()
WriteFile(fsB, "foo", []byte("foo"), 0644)
WriteFile(fsB, "qux/bar", []byte("foo"), 0644)
WriteFile(fsB, "qux/qux", []byte("foo"), 0644)
+ fsB.Symlink("foo", "bar")
ch, err := merkletrie.DiffTree(
NewRootNode(fsA, nil),
@@ -41,6 +43,23 @@ func (s *NoderSuite) TestDiff(c *C) {
c.Assert(ch, HasLen, 0)
}
+func (s *NoderSuite) TestDiffChangeLink(c *C) {
+ fsA := memfs.New()
+ fsA.Symlink("qux", "foo")
+
+ fsB := memfs.New()
+ fsB.Symlink("bar", "foo")
+
+ ch, err := merkletrie.DiffTree(
+ NewRootNode(fsA, nil),
+ NewRootNode(fsB, nil),
+ IsEquals,
+ )
+
+ c.Assert(err, IsNil)
+ c.Assert(ch, HasLen, 1)
+}
+
func (s *NoderSuite) TestDiffChangeContent(c *C) {
fsA := memfs.New()
WriteFile(fsA, "foo", []byte("foo"), 0644)