MCPcopy Create free account
hub / github.com/bytebase/bytebase / runLimitTest

Function runLimitTest

backend/plugin/db/mssql/query_test.go:25–51  ·  view source on GitHub ↗
(t *testing.T, file string, record bool)

Source from the content-addressed store, hash-verified

23}
24
25func runLimitTest(t *testing.T, file string, record bool) {
26 var testCases []limitTestData
27 filepath := filepath.Join("test-data", file)
28 yamlFile, err := os.Open(filepath)
29 require.NoError(t, err)
30 defer yamlFile.Close()
31
32 byteValue, err := io.ReadAll(yamlFile)
33 require.NoError(t, err)
34 err = yaml.Unmarshal(byteValue, &testCases)
35 require.NoError(t, err)
36
37 for i, tc := range testCases {
38 want := getStatementWithResultLimit(tc.Stmt, tc.Limit)
39 if record {
40 testCases[i].Want = want
41 } else {
42 require.Equal(t, tc.Want, want, tc.Stmt)
43 }
44 }
45
46 if record {
47 err := yamlFile.Close()
48 require.NoError(t, err)
49 yamltest.Record(t, filepath, testCases)
50 }
51}

Callers 1

Calls 7

RecordFunction · 0.92
JoinMethod · 0.80
UnmarshalMethod · 0.80
OpenMethod · 0.65
CloseMethod · 0.65
EqualMethod · 0.65

Tested by

no test coverage detected