You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Expand CLAUDE.md with comprehensive development guide
Add detailed documentation including:
- Next test workflow using cmd/next-test
- Step-by-step implementation workflow
- Test structure and flags documentation
- TsqlAstParser setup and usage instructions
- Important rules about not modifying ast.json files
This tool finds all tests with `todo: true` in their metadata and returns the one with the shortest `query.sql` file.
12
+
13
+
## Workflow
14
+
15
+
1. Run `go run ./cmd/next-test` to find the next test to implement
16
+
2. Check the test's `query.sql` to understand what SQL needs parsing
17
+
3. Check the test's `ast.json` to understand the expected output format
18
+
4. Implement the necessary AST types in `ast/`
19
+
5. Add parser logic in `parser/parser.go`
20
+
6. Add JSON marshaling functions in `parser/parser.go`
21
+
7. Enable the test by removing `todo: true` from its `metadata.json` (set it to `{}`)
22
+
8. Run `go test ./parser/... -timeout 5s` to verify
23
+
9. Check if other todo tests now pass (see below)
2
24
3
25
## Running Tests
4
26
@@ -10,12 +32,84 @@ go test ./parser/... -timeout 5s
10
32
11
33
The tests are very fast. If a test is timing out, it indicates a bug (likely an infinite loop in the parser).
12
34
13
-
## Checking Skipped Tests
35
+
## Checking for Newly Passing Todo Tests
14
36
15
-
After fixing parser issues, check if any skipped tests now pass:
37
+
After implementing parser changes, run:
16
38
17
39
```bash
18
-
go test ./parser -check-skipped -v 2>&1| grep "PASSES NOW"
40
+
go test ./parser/... -only-todo -v 2>&1| grep "PASS:"
19
41
```
20
42
21
-
Tests that output `PASSES NOW` can have their `todo` flag removed from `metadata.json`. This helps identify when parser improvements fix multiple tests at once.
43
+
This shows any todo tests that now pass. Enable those tests by removing `todo: true` from their `metadata.json`.
44
+
45
+
Available test flags:
46
+
47
+
-`-only-todo` - Run only todo/invalid_syntax tests (find newly passing tests)
48
+
-`-run-todo` - Run todo/invalid_syntax tests along with normal tests
49
+
50
+
## Test Structure
51
+
52
+
Each test in `parser/testdata/` contains:
53
+
54
+
-`metadata.json` - `{}` for enabled tests, `{"todo": true}` for pending tests, or `{"invalid_syntax": true}` for tests with invalid SQL
55
+
-`query.sql` - T-SQL to parse
56
+
-`ast.json` - Expected AST output
57
+
58
+
## Important Rules
59
+
60
+
**NEVER modify `ast.json` files** - These are golden files containing the expected output. If tests fail due to JSON mismatches, fix the Go code to match the expected output, not the other way around.
61
+
62
+
## Generating ast.json with TsqlAstParser
63
+
64
+
The `TsqlAstParser/` directory contains a C# tool that generates `ast.json` files using Microsoft's official T-SQL parser (ScriptDom).
0 commit comments