MCPcopy
hub / github.com/sqlc-dev/sqlc / BenchmarkReplay

Function BenchmarkReplay

internal/endtoend/endtoend_test.go:369–399  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

367}
368
369func BenchmarkReplay(b *testing.B) {
370 ctx := context.Background()
371 var dirs []string
372 err := filepath.Walk("testdata", func(path string, info os.FileInfo, err error) error {
373 if err != nil {
374 return err
375 }
376 if info.Name() == "sqlc.json" || info.Name() == "sqlc.yaml" || info.Name() == "sqlc.yml" {
377 dirs = append(dirs, filepath.Dir(path))
378 return filepath.SkipDir
379 }
380 return nil
381 })
382 if err != nil {
383 b.Fatal(err)
384 }
385 for _, replay := range dirs {
386 tc := replay
387 b.Run(tc, func(b *testing.B) {
388 path, _ := filepath.Abs(tc)
389 for i := 0; i < b.N; i++ {
390 var stderr bytes.Buffer
391 opts := &cmd.Options{
392 Env: cmd.Env{},
393 Stderr: &stderr,
394 }
395 cmd.Generate(ctx, path, "", opts)
396 }
397 })
398 }
399}

Callers

nothing calls this directly

Calls 3

GenerateFunction · 0.92
AbsMethod · 0.80
NameMethod · 0.65

Tested by

no test coverage detected