aboutsummaryrefslogtreecommitdiffstats
path: root/utils/merkletrie/filesystem/node_test.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2017-06-19 12:24:28 +0200
committerGitHub <noreply@github.com>2017-06-19 12:24:28 +0200
commit8b17cf05989402408ee1b66953a12ebfdf700aac (patch)
tree512411e012ef8ff2cf1a51e8785d9edb3b4c2332 /utils/merkletrie/filesystem/node_test.go
parent3ae5d4de35e76f2f573b550d93bb2aed8137f1cb (diff)
parentada10c2978a6c7dea8109f2d92dd092f57f9de84 (diff)
downloadgo-git-8b17cf05989402408ee1b66953a12ebfdf700aac.tar.gz
Merge pull request #436 from mcuadros/symlink
worktree: symlink support
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)