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

Function TestWalkThroughANTLR

backend/plugin/schema/pg/walk_through_test.go:130–231  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

128}
129
130func TestWalkThroughANTLR(t *testing.T) {
131 originDatabase := &storepb.DatabaseSchemaMetadata{
132 Name: "postgres",
133 Schemas: []*storepb.SchemaMetadata{
134 {
135 Name: "public",
136 Tables: []*storepb.TableMetadata{
137 {
138 Name: "test",
139 Columns: []*storepb.ColumnMetadata{
140 {
141 Name: "id",
142 Type: "int",
143 Nullable: false,
144 Position: 1,
145 },
146 {
147 Name: "name",
148 Type: "varchar(20)",
149 Nullable: true,
150 Position: 2,
151 },
152 },
153 },
154 },
155 Views: []*storepb.ViewMetadata{
156 {
157 Name: "v1",
158 Definition: "SELECT id, name FROM test",
159 DependencyColumns: []*storepb.DependencyColumn{
160 {
161 Schema: "public",
162 Table: "test",
163 Column: "id",
164 },
165 {
166 Schema: "public",
167 Table: "test",
168 Column: "name",
169 },
170 },
171 },
172 },
173 },
174 },
175 }
176
177 tests := []testData{}
178 targetPath := filepath.Join("testdata", "walk_through.yaml")
179 yamlFile, err := os.Open(targetPath)
180 require.NoError(t, err)
181 defer yamlFile.Close()
182
183 byteValue, err := io.ReadAll(yamlFile)
184 require.NoError(t, err)
185 err = yaml.Unmarshal(byteValue, &tests)
186 require.NoError(t, err)
187

Callers

nothing calls this directly

Calls 11

GetProtoMethod · 0.95
NewDatabaseMetadataFunction · 0.92
ParseStatementsFunction · 0.92
ExtractASTsFunction · 0.92
JoinMethod · 0.80
UnmarshalMethod · 0.80
FatalfMethod · 0.80
WalkThroughWithContextFunction · 0.70
OpenMethod · 0.65
CloseMethod · 0.65
EqualMethod · 0.65

Tested by

no test coverage detected