From 303a5dab6ac749e7a0cbe588b8e5f22108fdcccb Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Sun, 5 May 2019 12:50:47 +0200 Subject: [PATCH] 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). --- internal/archiver/archiver_test.go | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/internal/archiver/archiver_test.go b/internal/archiver/archiver_test.go index 201ee1a10..aff4f10f3 100644 --- a/internal/archiver/archiver_test.go +++ b/internal/archiver/archiver_test.go @@ -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") } }