| 337 | } |
| 338 | |
| 339 | func copyFromStdin(t *testing.T, conn *pgx.Conn, query string, filename string) { |
| 340 | filePath := filepath.Join("testdata", filename) |
| 341 | |
| 342 | file, err := os.Open(filePath) |
| 343 | if err != nil { |
| 344 | t.Fatalf("Failed to open file: %v", err) |
| 345 | } |
| 346 | defer file.Close() |
| 347 | |
| 348 | reader := bufio.NewReader(file) |
| 349 | _, err = conn.PgConn().CopyFrom(context.Background(), reader, query) |
| 350 | require.NoError(t, err) |
| 351 | } |
| 352 | |
| 353 | // RunScripts runs the given collection of scripts. This normalizes all rows before comparing them. |
| 354 | func RunScripts(t *testing.T, scripts []ScriptTest) { |