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

Function BenchmarkExamples

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

Source from the content-addressed store, hash-verified

72}
73
74func BenchmarkExamples(b *testing.B) {
75 ctx := context.Background()
76 examples, err := filepath.Abs(filepath.Join("..", "..", "examples"))
77 if err != nil {
78 b.Fatal(err)
79 }
80 files, err := os.ReadDir(examples)
81 if err != nil {
82 b.Fatal(err)
83 }
84 for _, replay := range files {
85 if !replay.IsDir() {
86 continue
87 }
88 tc := replay.Name()
89 b.Run(tc, func(b *testing.B) {
90 path := filepath.Join(examples, tc)
91 for i := 0; i < b.N; i++ {
92 var stderr bytes.Buffer
93 opts := &cmd.Options{
94 Env: cmd.Env{},
95 Stderr: &stderr,
96 }
97 cmd.Generate(ctx, path, "", opts)
98 }
99 })
100 }
101}
102
103type textContext struct {
104 Mutate func(*testing.T, string) func(*config.Config)

Callers

nothing calls this directly

Calls 4

GenerateFunction · 0.92
AbsMethod · 0.80
NameMethod · 0.65
JoinMethod · 0.45

Tested by

no test coverage detected