Skip to content

Commit e64a738

Browse files
max-sixtyclaude
andauthored
docs: Add CLAUDE.md testing guide for prqlc tests (#5612)
Co-authored-by: Claude <noreply@anthropic.com>
1 parent e45644c commit e64a738

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

prqlc/prqlc/tests/CLAUDE.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Tests
2+
3+
## Structure
4+
5+
- **`integration/sql.rs`** — Unit tests for PRQL→SQL compilation. Fast, focused,
6+
preferred for most changes.
7+
- **`integration/queries/*.prql`** — Integration tests generating 6 snapshots
8+
each (different SQL dialects). Use sparingly.
9+
- **`integration/error_messages.rs`** — Tests for compiler error diagnostics.
10+
- **`integration/dbs/`** — Database runners for executing queries against real
11+
databases.
12+
13+
## Guidelines
14+
15+
**80% unit tests, 20% integration tests.** Integration tests in
16+
`integration/queries/` are verbose — each `.prql` file generates six snapshot
17+
files. Prefer unit tests in [`integration/sql.rs`](./integration/sql.rs):
18+
19+
```rust
20+
#[test]
21+
fn test_my_feature() {
22+
assert_snapshot!(compile(r#"
23+
from foo
24+
select bar
25+
"#).unwrap(), @"...");
26+
}
27+
```
28+
29+
New integration test files are appropriate when validating against real
30+
databases or testing behavior across compilation stages. Extend existing tests
31+
when possible.

0 commit comments

Comments
 (0)