aboutsummaryrefslogtreecommitdiffstats
path: root/utils/merkletrie/filesystem/node_test.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2017-06-18 21:16:23 +0200
committerMáximo Cuadros <mcuadros@gmail.com>2017-06-18 21:16:23 +0200
commit1fd0a4963b4a5002b23bf4faa7814adca73818d6 (patch)
tree628051b686f71898965c0febd3e13097b2f64362 /utils/merkletrie/filesystem/node_test.go
parent5d1c674ea818ea534476ed0ca5436e0b513f86a4 (diff)
downloadgo-git-1fd0a4963b4a5002b23bf4faa7814adca73818d6.tar.gz
utils: merkletrie support for symlinks
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)