MCPcopy Create free account
hub / github.com/temporalio/temporal / TestProcessDir

Function TestProcessDir

tools/parallelize/parallelize_test.go:145–175  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

143}
144
145func TestProcessDir(t *testing.T) {
146 t.Parallel()
147
148 dir := t.TempDir()
149
150 testFile := `package foo_test
151
152import "testing"
153
154func TestFoo(t *testing.T) {
155 t.Log("hello")
156}
157`
158 nonTestFile := `package foo
159
160func Foo() {}
161`
162
163 require.NoError(t, os.WriteFile(filepath.Join(dir, "foo_test.go"), []byte(testFile), 0644))
164 require.NoError(t, os.WriteFile(filepath.Join(dir, "foo.go"), []byte(nonTestFile), 0644))
165
166 require.NoError(t, processDir(dir))
167
168 got, err := os.ReadFile(filepath.Join(dir, "foo_test.go"))
169 require.NoError(t, err)
170 require.Contains(t, string(got), "t.Parallel()")
171
172 got, err = os.ReadFile(filepath.Join(dir, "foo.go"))
173 require.NoError(t, err)
174 require.Equal(t, nonTestFile, string(got))
175}

Callers

nothing calls this directly

Calls 5

processDirFunction · 0.85
NoErrorMethod · 0.80
ReadFileMethod · 0.65
ContainsMethod · 0.65
EqualMethod · 0.65

Tested by

no test coverage detected