]> ruderich.org/simon Gitweb - safcm/safcm.git/blobdiff - cmd/safcm-remote/sync/sync_test.go
sync: tests: use variable to reduce line wrapping
[safcm/safcm.git] / cmd / safcm-remote / sync / sync_test.go
index 4c0f08d5abdf6515f4da8df503b2088fd71d355d..52d7435eadcea20abff6fbbc2f9e33639878692d 100644 (file)
@@ -31,6 +31,8 @@ import (
        "ruderich.org/simon/safcm/cmd/safcm-remote/run"
 )
 
+// testRunner implements run.Runner to test commands without actually running
+// them.
 type testRunner struct {
        t         *testing.T
        expCmds   []*exec.Cmd
@@ -78,10 +80,8 @@ func (r *testRunner) check(method string, cmd *exec.Cmd) (
        exp := r.expCmds[0]
        r.expCmds = r.expCmds[1:]
        if !reflect.DeepEqual(exp, cmd) {
-               r.t.Errorf("%s: %s", method,
-                       cmp.Diff(exp, cmd, cmpopts.IgnoreUnexported(
-                               exec.Cmd{},
-                               bytes.Buffer{})))
+               opts := cmpopts.IgnoreUnexported(exec.Cmd{}, bytes.Buffer{})
+               r.t.Errorf("%s: %s", method, cmp.Diff(exp, cmd, opts))
        }
 
        var stdout, stderr []byte