testmark-go

Change testexec API to take DirEnt pointers

commit aa5901ac18f6c8317a2bef95fb1742926d17aeb4 · parent 4d87fa095d · browse this tree
Calvin Behling, 2022-11-25 20:37:34 UTC

diff --git a/testexec/testexec.go b/testexec/testexec.go
index 10f3f3f..8006d83 100644
--- a/testexec/testexec.go
+++ b/testexec/testexec.go
@@ -139,22 +139,22 @@ func (tcfg *Tester) init() {
 // Regen mode will only update hunks that already exist; it won't add them.
 // As an edge case, note that if that an exitcode hunk is absent, but a nonzero exitcode is encountered,
 // the test will still be failed, even though in patch regen mode most assertions are usually skipped.
-func (tcfg Tester) TestSequence(t *testing.T, data testmark.DirEnt) {
+func (tcfg Tester) TestSequence(t *testing.T, data *testmark.DirEnt) {
 	t.Helper()
 	tcfg.test(t, data, true, false, "")
 }
 
-func (tcfg Tester) TestScript(t *testing.T, data testmark.DirEnt) {
+func (tcfg Tester) TestScript(t *testing.T, data *testmark.DirEnt) {
 	t.Helper()
 	tcfg.test(t, data, false, true, "")
 }
 
-func (tcfg Tester) Test(t *testing.T, data testmark.DirEnt) {
+func (tcfg Tester) Test(t *testing.T, data *testmark.DirEnt) {
 	t.Helper()
 	tcfg.test(t, data, true, true, "")
 }
 
-func (tcfg Tester) test(t *testing.T, data testmark.DirEnt, allowExec, allowScript bool, parentTmpdir string) {
+func (tcfg Tester) test(t *testing.T, data *testmark.DirEnt, allowExec, allowScript bool, parentTmpdir string) {
 	t.Helper()
 	tcfg.init()
 
@@ -309,7 +309,7 @@ func (tcfg Tester) test(t *testing.T, data testmark.DirEnt, allowExec, allowScri
 				if alreadyFailed {
 					t.Skipf("parent commands failed, so while more commands are specified, testing them is not meaningful")
 				}
-				tcfg.test(t, *child, allowExec, allowScript, dir)
+				tcfg.test(t, child, allowExec, allowScript, dir)
 			})
 		}
 	}
diff --git a/testexec/testexec_test.go b/testexec/testexec_test.go
index 6968087..0701f4a 100644
--- a/testexec/testexec_test.go
+++ b/testexec/testexec_test.go
@@ -21,7 +21,7 @@ func Test(t *testing.T) {
 			test := testexec.Tester{
 				Patches: &patches,
 			}
-			test.TestScript(t, *dir)
+			test.TestScript(t, dir)
 		})
 	}
 	patches.WriteFileWithPatches(doc, filename)