diff options
Diffstat (limited to 'utils')
-rw-r--r-- | utils/diff/diff_ext_test.go | 31 | ||||
-rw-r--r-- | utils/merkletrie/difftree.go | 10 | ||||
-rw-r--r-- | utils/merkletrie/difftree_test.go | 2 | ||||
-rw-r--r-- | utils/merkletrie/internal/frame/frame.go | 4 | ||||
-rw-r--r-- | utils/merkletrie/internal/fsnoder/doc.go | 2 | ||||
-rw-r--r-- | utils/merkletrie/internal/fsnoder/file.go | 2 | ||||
-rw-r--r-- | utils/merkletrie/internal/fsnoder/new_test.go | 4 | ||||
-rw-r--r-- | utils/merkletrie/iter_test.go | 2 | ||||
-rw-r--r-- | utils/merkletrie/noder/path_test.go | 4 |
9 files changed, 46 insertions, 15 deletions
diff --git a/utils/diff/diff_ext_test.go b/utils/diff/diff_ext_test.go index adda276..c6c7e90 100644 --- a/utils/diff/diff_ext_test.go +++ b/utils/diff/diff_ext_test.go @@ -99,6 +99,37 @@ var doTests = [...]struct { {Type: 1, Text: "111\nBCD\n"}, }, }, + { + src: "A\nB\nC\nD\nE\nF\nG\nH\nI\nJ\nK\nL\nM\nN\nÑ\nO\nP\nQ\nR\nS\nT\nU\nV\nW\nX\nY\nZ", + dst: "B\nC\nD\nE\nF\nG\nI\nJ\nK\nL\nM\nN\nO\nP\nQ\nR\nS\nT\nV\nW\nX\nY\nZ", + exp: []diffmatchpatch.Diff{ + {Type: -1, Text: "A\n"}, + {Type: 0, Text: "B\nC\nD\nE\nF\nG\n"}, + {Type: -1, Text: "H\n"}, + {Type: 0, Text: "I\nJ\nK\nL\nM\nN\n"}, + {Type: -1, Text: "Ñ\n"}, + {Type: 0, Text: "O\nP\nQ\nR\nS\nT\n"}, + {Type: -1, Text: "U\n"}, + {Type: 0, Text: "V\nW\nX\nY\nZ"}, + }, + }, + { + src: "B\nC\nD\nE\nF\nG\nI\nJ\nK\nL\nM\nN\nO\nP\nQ\nR\nS\nT\nV\nW\nX\nY\nZ", + dst: "B\nC\nD\nE\nF\nG\nI\nJ\nK\nL\nM\nN\nO\nP\nQ\nR\nS\nT\nV\nW\nX\nY\n", + exp: []diffmatchpatch.Diff{ + {Type: 0, Text: "B\nC\nD\nE\nF\nG\nI\nJ\nK\nL\nM\nN\nO\nP\nQ\nR\nS\nT\nV\nW\nX\nY\n"}, + {Type: -1, Text: "Z"}, + }, + }, + { + src: "B\nC\nD\nE\nF\nG\nI\nJ\nK\nL\nM\nN\nO\nP\nQ\nR\nS\nT\nV\nW\nX\nY\nZ", + dst: "B\nC\nD\nE\nF\nG\nI\nJ\nK\nL\nM\nN\nO\nP\nQ\nR\nS\nT\nV\nW\nX\nY", + exp: []diffmatchpatch.Diff{ + {Type: 0, Text: "B\nC\nD\nE\nF\nG\nI\nJ\nK\nL\nM\nN\nO\nP\nQ\nR\nS\nT\nV\nW\nX\n"}, + {Type: -1, Text: "Y\nZ"}, + {Type: 1, Text: "Y"}, + }, + }, } func (s *suiteCommon) TestDo(c *C) { diff --git a/utils/merkletrie/difftree.go b/utils/merkletrie/difftree.go index d57ed13..77ba5a8 100644 --- a/utils/merkletrie/difftree.go +++ b/utils/merkletrie/difftree.go @@ -8,7 +8,7 @@ package merkletrie // type defined in this same package; we will iterate over both // trees at the same time, while comparing the current noders in // each iterator. Depending on how they differ we will output the -// corresponding chages and move the iterators further over both +// corresponding changes and move the iterators further over both // trees. // // The table bellow show all the possible comparison results, along @@ -69,7 +69,7 @@ package merkletrie // // ### C. To was created: 01, 02, 03, 04, 05, 06 // - check: `DifferentName() && ToBeforeFrom()` -// - action: inserRecursively(to) +// - action: insertRecursively(to) // - advance: `ToNext()` // // ### D. From was deleted: 10, 20, 30, 40, 50, 60 @@ -131,13 +131,13 @@ package merkletrie // - action: `DeleteDir(from); InsertFile(to)` // - advance: `FromNext(); ToNext()` // -// ### J. file with contents to dir with contetns: 25, 26, 35, 36 +// ### J. file with contents to dir with contents: 25, 26, 35, 36 // - check: `SameName() && DifferentHash() && FromIsFile() && // FromIsNotEmpty() && ToIsDir() && ToIsNotEmpty()` // - action: `DeleteFile(from); InsertDirRecursively(to)` // - advance: `FromNext(); ToNext()` // -// ### J'. dir with contetns to file with contents: 52, 62, 53, 63 +// ### J'. dir with contents to file with contents: 52, 62, 53, 63 // - check: `SameName() && DifferentHash() && FromIsDir() && // FromIsNotEmpty() && ToIsFile() && ToIsNotEmpty()` // - action: `DeleteDirRecursively(from); InsertFile(to)` @@ -216,7 +216,7 @@ package merkletrie // 1 0 1 0 1 0 | a() | a<1> | I' | f | delete(from); insert(to); NN // 1 0 1 0 1 1 | a() | a<> | F' | f | delete(from); insert(to); NN // 1 0 1 1 0 0 | a(...) | a(;;;) | L | g | nothing; SS -// 1 0 1 1 0 1 | a(...) | a() | K' | h | deleteChidren(from); NN +// 1 0 1 1 0 1 | a(...) | a() | K' | h | deleteChildren(from); NN // 1 0 1 1 1 0 | a() | a(...) | K | i | insertChildren(to); NN // 1 0 1 1 1 1 | ---- | ---- | | | // 1 1 0 0 0 0 | a<1> | a<1> | B | b | nothing; NN diff --git a/utils/merkletrie/difftree_test.go b/utils/merkletrie/difftree_test.go index ac86145..f725bcf 100644 --- a/utils/merkletrie/difftree_test.go +++ b/utils/merkletrie/difftree_test.go @@ -177,7 +177,7 @@ func newChangesFromString(s string) (changes, error) { for _, chunk := range strings.Split(s, " ") { change := change{ - path: string(chunk[1:]), + path: chunk[1:], } switch chunk[0] { diff --git a/utils/merkletrie/internal/frame/frame.go b/utils/merkletrie/internal/frame/frame.go index a0b042e..77a3de4 100644 --- a/utils/merkletrie/internal/frame/frame.go +++ b/utils/merkletrie/internal/frame/frame.go @@ -38,7 +38,7 @@ func New(n noder.Noder) (*Frame, error) { } // String returns the quoted names of the noders in the frame sorted in -// alphabeticall order by name, surrounded by square brackets and +// alphabetical order by name, surrounded by square brackets and // separated by comas. // // Examples: @@ -61,7 +61,7 @@ func (f *Frame) String() string { } // First returns, but dont extract, the noder with the alphabetically -// smaller name in the frame and true if the frame was not empy. +// smaller name in the frame and true if the frame was not empty. // Otherwise it returns nil and false. func (f *Frame) First() (noder.Noder, bool) { if f.Len() == 0 { diff --git a/utils/merkletrie/internal/fsnoder/doc.go b/utils/merkletrie/internal/fsnoder/doc.go index 3f55b5f..c79ac59 100644 --- a/utils/merkletrie/internal/fsnoder/doc.go +++ b/utils/merkletrie/internal/fsnoder/doc.go @@ -30,7 +30,7 @@ Directories are expressed as: - its elements between parents, separated with spaces, in any order. -- (optionally) the root directory can be unnamed, by skiping its name. +- (optionally) the root directory can be unnamed, by skipping its name. Examples: diff --git a/utils/merkletrie/internal/fsnoder/file.go b/utils/merkletrie/internal/fsnoder/file.go index c975a60..686a675 100644 --- a/utils/merkletrie/internal/fsnoder/file.go +++ b/utils/merkletrie/internal/fsnoder/file.go @@ -60,7 +60,7 @@ const ( fileEndMark = '>' ) -// String returns a string formated as: name<contents>. +// String returns a string formatted as: name<contents>. func (f *file) String() string { var buf bytes.Buffer buf.WriteString(f.name) diff --git a/utils/merkletrie/internal/fsnoder/new_test.go b/utils/merkletrie/internal/fsnoder/new_test.go index 805772f..a2c474a 100644 --- a/utils/merkletrie/internal/fsnoder/new_test.go +++ b/utils/merkletrie/internal/fsnoder/new_test.go @@ -176,7 +176,7 @@ func (s *FSNoderSuite) TestEmptyDir(c *C) { check(c, input, expected) } -func (s *FSNoderSuite) TestDirWithEmtpyFile(c *C) { +func (s *FSNoderSuite) TestDirWithEmptyFile(c *C) { input := "(A(a<>))" a, err := newFile("a", "") @@ -189,7 +189,7 @@ func (s *FSNoderSuite) TestDirWithEmtpyFile(c *C) { check(c, input, expected) } -func (s *FSNoderSuite) TestDirWithEmtpyFileSameName(c *C) { +func (s *FSNoderSuite) TestDirWithEmptyFileSameName(c *C) { input := "(A(A<>))" f, err := newFile("A", "") diff --git a/utils/merkletrie/iter_test.go b/utils/merkletrie/iter_test.go index b334cf1..3b24043 100644 --- a/utils/merkletrie/iter_test.go +++ b/utils/merkletrie/iter_test.go @@ -95,7 +95,7 @@ func (t test) run(c *C, iter *merkletrie.Iter, } // A testsCollection value represents a tree and a collection of tests -// we want to perfrom on iterators of that tree. +// we want to perform on iterators of that tree. // // Example: // diff --git a/utils/merkletrie/noder/path_test.go b/utils/merkletrie/noder/path_test.go index f49f028..f65b1d5 100644 --- a/utils/merkletrie/noder/path_test.go +++ b/utils/merkletrie/noder/path_test.go @@ -154,8 +154,8 @@ func (s *PathSuite) TestCompareMixedDepths(c *C) { } func (s *PathSuite) TestCompareNormalization(c *C) { - p1 := Path([]Noder{&noderMock{name: norm.Form(norm.NFKC).String("페")}}) - p2 := Path([]Noder{&noderMock{name: norm.Form(norm.NFKD).String("페")}}) + p1 := Path([]Noder{&noderMock{name: norm.NFKC.String("페")}}) + p2 := Path([]Noder{&noderMock{name: norm.NFKD.String("페")}}) c.Assert(p1.Compare(p2), Equals, 1) c.Assert(p2.Compare(p1), Equals, -1) p1 = Path([]Noder{&noderMock{name: "TestAppWithUnicodéPath"}}) |