mirror of
https://github.com/octoleo/restic.git
synced 2024-12-26 20:30:19 +00:00
archiver: Clarify value in test struct
Since I could not remember what the value for `Check` means this commit renames it to `SameFile`: when set to true, the test should make sure that `FileChanged` should return false (=file is unmodified).
This commit is contained in:
parent
7dcd2968b6
commit
303a5dab6a
@ -560,7 +560,7 @@ func TestFileChanged(t *testing.T) {
|
||||
Content []byte
|
||||
Modify func(t testing.TB, filename string)
|
||||
IgnoreInode bool
|
||||
Check bool
|
||||
SameFile bool
|
||||
}{
|
||||
{
|
||||
Name: "same-content-new-file",
|
||||
@ -622,7 +622,7 @@ func TestFileChanged(t *testing.T) {
|
||||
setTimestamp(t, filename, fi.ModTime(), fi.ModTime())
|
||||
},
|
||||
IgnoreInode: true,
|
||||
Check: true,
|
||||
SameFile: true,
|
||||
},
|
||||
}
|
||||
|
||||
@ -648,10 +648,15 @@ func TestFileChanged(t *testing.T) {
|
||||
test.Modify(t, filename)
|
||||
|
||||
fiAfter := lstat(t, filename)
|
||||
if test.Check == fileChanged(fiAfter, node, test.IgnoreInode) {
|
||||
if test.Check {
|
||||
|
||||
if test.SameFile {
|
||||
// file should be detected as unchanged
|
||||
if fileChanged(fiAfter, node, test.IgnoreInode) {
|
||||
t.Fatalf("unmodified file detected as changed")
|
||||
} else {
|
||||
}
|
||||
} else {
|
||||
// file should be detected as changed
|
||||
if !fileChanged(fiAfter, node, test.IgnoreInode) && !test.SameFile {
|
||||
t.Fatalf("modified file detected as unchanged")
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user