Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
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>
  • Loading branch information
claude committed Oct 25, 2025
commit cc41aced154a9bc7e5eb41c7be7081ff0adb7ee6
118 changes: 0 additions & 118 deletions examples/skip_parser/README.md

This file was deleted.

4 changes: 0 additions & 4 deletions examples/skip_parser/postgresql/.gitignore

This file was deleted.

165 changes: 0 additions & 165 deletions examples/skip_parser/postgresql/db_test.go

This file was deleted.

34 changes: 0 additions & 34 deletions examples/skip_parser/postgresql/query.sql

This file was deleted.

11 changes: 0 additions & 11 deletions examples/skip_parser/postgresql/schema.sql

This file was deleted.

15 changes: 0 additions & 15 deletions examples/skip_parser/sqlc.yaml

This file was deleted.

Loading
Loading