File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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.
You can’t perform that action at this time.
0 commit comments