(t *testing.T)
| 128 | } |
| 129 | |
| 130 | func 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 |
nothing calls this directly
no test coverage detected