Archived
tests: messagediff argument order should be expected, actual
So that the diff describes the changes that happened in actual as compared to expected. The opposite is confusing.
This commit is contained in:
1 parent
78120bd989
commit
c439c543d0
4 files changed
+23
-23
No files matched your search
+10
-10
@@ -127,35 +127,35 @@ func TestBringToFront(t *testing.T) {
|
||||
q.Push("f4", 0, 0)
|
||||
|
||||
_, queued := q.Jobs()
|
||||
if diff, equal := messagediff.PrettyDiff(queued, []string{"f1", "f2", "f3", "f4"}); !equal {
|
||||
if diff, equal := messagediff.PrettyDiff([]string{"f1", "f2", "f3", "f4"}, queued); !equal {
|
||||
t.Errorf("Order does not match. Diff:\n%s", diff)
|
||||
}
|
||||
|
||||
q.BringToFront("f1") // corner case: does nothing
|
||||
|
||||
_, queued = q.Jobs()
|
||||
if diff, equal := messagediff.PrettyDiff(queued, []string{"f1", "f2", "f3", "f4"}); !equal {
|
||||
if diff, equal := messagediff.PrettyDiff([]string{"f1", "f2", "f3", "f4"}, queued); !equal {
|
||||
t.Errorf("Order does not match. Diff:\n%s", diff)
|
||||
}
|
||||
|
||||
q.BringToFront("f3")
|
||||
|
||||
_, queued = q.Jobs()
|
||||
if diff, equal := messagediff.PrettyDiff(queued, []string{"f3", "f1", "f2", "f4"}); !equal {
|
||||
if diff, equal := messagediff.PrettyDiff([]string{"f3", "f1", "f2", "f4"}, queued); !equal {
|
||||
t.Errorf("Order does not match. Diff:\n%s", diff)
|
||||
}
|
||||
|
||||
q.BringToFront("f2")
|
||||
|
||||
_, queued = q.Jobs()
|
||||
if diff, equal := messagediff.PrettyDiff(queued, []string{"f2", "f3", "f1", "f4"}); !equal {
|
||||
if diff, equal := messagediff.PrettyDiff([]string{"f2", "f3", "f1", "f4"}, queued); !equal {
|
||||
t.Errorf("Order does not match. Diff:\n%s", diff)
|
||||
}
|
||||
|
||||
q.BringToFront("f4") // corner case: last element
|
||||
|
||||
_, queued = q.Jobs()
|
||||
if diff, equal := messagediff.PrettyDiff(queued, []string{"f4", "f2", "f3", "f1"}); !equal {
|
||||
if diff, equal := messagediff.PrettyDiff([]string{"f4", "f2", "f3", "f1"}, queued); !equal {
|
||||
t.Errorf("Order does not match. Diff:\n%s", diff)
|
||||
}
|
||||
}
|
||||
@@ -176,7 +176,7 @@ func TestShuffle(t *testing.T) {
|
||||
}
|
||||
|
||||
t.Logf("%v", queued)
|
||||
if _, equal := messagediff.PrettyDiff(queued, []string{"f1", "f2", "f3", "f4"}); !equal {
|
||||
if _, equal := messagediff.PrettyDiff([]string{"f1", "f2", "f3", "f4"}, queued); !equal {
|
||||
// The queue was shuffled
|
||||
return
|
||||
}
|
||||
@@ -200,7 +200,7 @@ func TestSortBySize(t *testing.T) {
|
||||
}
|
||||
expected := []string{"f4", "f1", "f3", "f2"}
|
||||
|
||||
if diff, equal := messagediff.PrettyDiff(actual, expected); !equal {
|
||||
if diff, equal := messagediff.PrettyDiff(expected, actual); !equal {
|
||||
t.Errorf("SortSmallestFirst() diff:\n%s", diff)
|
||||
}
|
||||
|
||||
@@ -212,7 +212,7 @@ func TestSortBySize(t *testing.T) {
|
||||
}
|
||||
expected = []string{"f2", "f3", "f1", "f4"}
|
||||
|
||||
if diff, equal := messagediff.PrettyDiff(actual, expected); !equal {
|
||||
if diff, equal := messagediff.PrettyDiff(expected, actual); !equal {
|
||||
t.Errorf("SortLargestFirst() diff:\n%s", diff)
|
||||
}
|
||||
}
|
||||
@@ -232,7 +232,7 @@ func TestSortByAge(t *testing.T) {
|
||||
}
|
||||
expected := []string{"f4", "f1", "f3", "f2"}
|
||||
|
||||
if diff, equal := messagediff.PrettyDiff(actual, expected); !equal {
|
||||
if diff, equal := messagediff.PrettyDiff(expected, actual); !equal {
|
||||
t.Errorf("SortOldestFirst() diff:\n%s", diff)
|
||||
}
|
||||
|
||||
@@ -244,7 +244,7 @@ func TestSortByAge(t *testing.T) {
|
||||
}
|
||||
expected = []string{"f2", "f3", "f1", "f4"}
|
||||
|
||||
if diff, equal := messagediff.PrettyDiff(actual, expected); !equal {
|
||||
if diff, equal := messagediff.PrettyDiff(expected, actual); !equal {
|
||||
t.Errorf("SortNewestFirst() diff:\n%s", diff)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user