Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
03a1db8eb6 |
No files matched your search
@@ -491,9 +491,9 @@ func TestReadReportChecksOnlyPossibleDuplicates(t *testing.T) {
|
|||||||
|
|
||||||
a, u, e := testHash("a"), testHash("u"), sha256.Sum256(nil)
|
a, u, e := testHash("a"), testHash("u"), sha256.Sum256(nil)
|
||||||
recs := []scanRec{
|
recs := []scanRec{
|
||||||
{size: 9, head: a, tail: a, content: a, path: "/x/1"},
|
{size: 9, head: a, tail: a, content: a, path: "/copy/1"},
|
||||||
{size: 9, head: a, tail: a, content: a, path: "/x/2"},
|
{size: 9, head: a, tail: a, content: a, path: "/copy/2"},
|
||||||
{size: 9, head: a, tail: a, content: a, path: "/x/3"},
|
{size: 9, head: a, tail: a, content: a, path: "/copy/3"},
|
||||||
{size: 9, head: u, tail: u, content: u, path: "/lonely"},
|
{size: 9, head: u, tail: u, content: u, path: "/lonely"},
|
||||||
{size: 0, head: e, tail: e, content: e, path: "/empty1"},
|
{size: 0, head: e, tail: e, content: e, path: "/empty1"},
|
||||||
{size: 0, head: e, tail: e, content: e, path: "/empty2"},
|
{size: 0, head: e, tail: e, content: e, path: "/empty2"},
|
||||||
@@ -521,7 +521,7 @@ func TestReadReportChecksOnlyPossibleDuplicates(t *testing.T) {
|
|||||||
|
|
||||||
slices.Sort(checked)
|
slices.Sort(checked)
|
||||||
|
|
||||||
want := []string{"/x/1", "/x/2", "/x/3"}
|
want := []string{"/copy/1", "/copy/2", "/copy/3"}
|
||||||
if !slices.Equal(checked, want) {
|
if !slices.Equal(checked, want) {
|
||||||
t.Errorf("paths checked on disk = %q, want %q", checked, want)
|
t.Errorf("paths checked on disk = %q, want %q", checked, want)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -503,20 +503,16 @@ func TestCollectTreeGroupsDifferingParents(t *testing.T) {
|
|||||||
// TestCollectTreeGroupsChecksOnlyReportedCopies checks that trees asks
|
// TestCollectTreeGroupsChecksOnlyReportedCopies checks that trees asks
|
||||||
// whether a directory is on disk only for the members of the groups it
|
// whether a directory is on disk only for the members of the groups it
|
||||||
// returns. It never asks about /a/proj/sub, which lies inside a copy
|
// returns. It never asks about /a/proj/sub, which lies inside a copy
|
||||||
// and whose group the group of /a/proj implies, nor about /a/empty,
|
// and whose group the group of /a/proj implies.
|
||||||
// which holds 0 bytes.
|
|
||||||
func TestCollectTreeGroupsChecksOnlyReportedCopies(t *testing.T) {
|
func TestCollectTreeGroupsChecksOnlyReportedCopies(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
f, g, u, e := testHash("f"), testHash("g"), testHash("u"),
|
f, g, u := testHash("f"), testHash("g"), testHash("u")
|
||||||
sha256.Sum256(nil)
|
|
||||||
recs := []scanRec{
|
recs := []scanRec{
|
||||||
{size: 10, head: f, tail: f, content: f, path: "/a/proj/f"},
|
{size: 10, head: f, tail: f, content: f, path: "/a/proj/f"},
|
||||||
{size: 20, head: g, tail: g, content: g, path: "/a/proj/sub/g"},
|
{size: 20, head: g, tail: g, content: g, path: "/a/proj/sub/g"},
|
||||||
{size: 0, head: e, tail: e, content: e, path: "/a/empty/.gitkeep"},
|
|
||||||
{size: 10, head: f, tail: f, content: f, path: "/b/proj/f"},
|
{size: 10, head: f, tail: f, content: f, path: "/b/proj/f"},
|
||||||
{size: 20, head: g, tail: g, content: g, path: "/b/proj/sub/g"},
|
{size: 20, head: g, tail: g, content: g, path: "/b/proj/sub/g"},
|
||||||
{size: 0, head: e, tail: e, content: e, path: "/b/empty/.gitkeep"},
|
|
||||||
// /a lacks this file, so /a and /b are no copies of each other.
|
// /a lacks this file, so /a and /b are no copies of each other.
|
||||||
{size: 30, head: u, tail: u, content: u, path: "/b/lonely"},
|
{size: 30, head: u, tail: u, content: u, path: "/b/lonely"},
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user