diff --git a/README.md b/README.md index 42604f9..89ddd8f 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,6 @@ own repo from this collection we will. Feel free to open an issue to request. - ./diff - ./assert -- ./xtesting - ./xdefer - ./cmdlog - ./xterm @@ -45,10 +44,6 @@ beautiful diffs. note: `TestdataJSON` is extremely useful. -### [./xtesting](./xtesting) - -xtesting provides non assertion testing helpers. Currently only `RunCases`. - ![example output](./diff/example.png) - Strings diff --git a/cmdlog/cmdlog_test.go b/cmdlog/cmdlog_test.go index f06df55..2f2f450 100644 --- a/cmdlog/cmdlog_test.go +++ b/cmdlog/cmdlog_test.go @@ -13,7 +13,6 @@ import ( "oss.terrastruct.com/util-go/assert" "oss.terrastruct.com/util-go/cmdlog" "oss.terrastruct.com/util-go/xos" - "oss.terrastruct.com/util-go/xtesting" ) func TestLogger(t *testing.T) { @@ -144,18 +143,19 @@ yes %d`, 3, 4) }, } - var xtca []xtesting.Case + ctx := context.Background() for _, tc := range tca { tc := tc - xtca = append(xtca, xtesting.Case{ - Name: tc.name, - Run: func(t *testing.T, ctx context.Context) { - env := xos.NewEnv(nil) - tc.run(t, ctx, env) - }, + t.Run(tc.name, func(t *testing.T) { + t.Parallel() + + ctx, cancel := context.WithCancel(ctx) + defer cancel() + + env := xos.NewEnv(nil) + tc.run(t, ctx, env) }) } - xtesting.RunCases(t, context.Background(), xtca) } func testLogger(l *cmdlog.Logger) { diff --git a/xtesting/cases.go b/xtesting/cases.go deleted file mode 100644 index 26420a8..0000000 --- a/xtesting/cases.go +++ /dev/null @@ -1,25 +0,0 @@ -package xtesting - -import ( - "context" - "testing" -) - -type Case struct { - Name string - Run func(t *testing.T, ctx context.Context) -} - -func RunCases(t *testing.T, ctx context.Context, tca []Case) { - for _, tc := range tca { - tc := tc - t.Run(tc.Name, func(t *testing.T) { - t.Parallel() - - ctx, cancel := context.WithCancel(ctx) - defer cancel() - - tc.Run(t, ctx) - }) - } -}