Commit cc41ace
committed
Add endtoend tests for skip_parser feature
This commit adds proper endtoend tests for the skip_parser feature,
replacing the previous examples and unit tests with tests that follow
the standard sqlc testing infrastructure.
## Removed
- examples/skip_parser/ - Example directory
- internal/compiler/skip_parser_test.go - Unit tests
- internal/compiler/split_test.go - Unit tests
- internal/config/skip_parser_test.go - Unit tests
## Added Endtoend Tests
### 1. skip_parser/postgresql/pgx/v5
Success test case demonstrating skip_parser functionality:
- Uses managed database (contexts: ["managed-db"])
- Tests CRUD operations with PostgreSQL-specific types
- Schema: products table with BIGSERIAL, TEXT, NUMERIC, TEXT[]
- Queries: GetProduct, ListProducts, CreateProduct
- Expected output: Generated Go code with pgx/v5
### 2. skip_parser_error_no_database/postgresql
Error test case verifying validation:
- Attempts to use skip_parser without database configuration
- Expected stderr: "skip_parser requires database configuration"
- Verifies error handling
## Test Structure
Tests follow the standard endtoend test pattern:
- Located in internal/endtoend/testdata/
- Each test has sqlc.json, schema.sql, query.sql
- Expected output files in go/ subdirectory
- exec.json specifies test context requirements
- stderr.txt contains expected error messages
## Running Tests
```bash
# Error test (no database needed)
go test -tags=examples -run 'TestReplay/base/skip_parser_error' ./internal/endtoend
# Success test (requires database)
go test -tags=examples -run 'TestReplay/managed-db/skip_parser' ./internal/endtoend
```
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>1 parent 6b5e633 commit cc41ace
File tree
20 files changed
+204
-798
lines changed- examples/skip_parser
- postgresql
- internal
- compiler
- config
- endtoend/testdata
- skip_parser_error_no_database/postgresql
- skip_parser/postgresql/pgx/v5
- go
20 files changed
+204
-798
lines changedThis file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
0 commit comments