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
Add next-test command and adapt CLAUDE.md for this repo
- Create cmd/next-test to find the next todo test (shortest query first)
- Rewrite CLAUDE.md to match ClickHouse parser workflow:
- Tests use explain.txt (not ast.json)
- Remove TsqlAstParser section (not applicable)
- Document metadata options
Copy file name to clipboardExpand all lines: CLAUDE.md
+15-68Lines changed: 15 additions & 68 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,11 +13,11 @@ This tool finds all tests with `todo: true` in their metadata and returns the on
13
13
## Workflow
14
14
15
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
16
+
2. Check the test's `query.sql` to understand what ClickHouse SQL needs parsing
17
+
3. Check the test's `explain.txt` to understand the expected EXPLAIN output
18
18
4. Implement the necessary AST types in `ast/`
19
19
5. Add parser logic in `parser/parser.go`
20
-
6.Add JSON marshaling functions in `parser/parser.go`
20
+
6.Update the `Explain()` function if needed to match ClickHouse's output format
21
21
7. Enable the test by removing `todo: true` from its `metadata.json` (set it to `{}`)
22
22
8. Run `go test ./parser/... -timeout 5s` to verify
23
23
9. Check if other todo tests now pass (see below)
@@ -37,79 +37,26 @@ The tests are very fast. If a test is timing out, it indicates a bug (likely an
37
37
After implementing parser changes, run:
38
38
39
39
```bash
40
-
go test ./parser/... -only-todo -v 2>&1| grep "PASS:"
40
+
go test ./parser/... -check-skipped -v 2>&1| grep "PASSES NOW"
41
41
```
42
42
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
43
+
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.
49
44
50
45
## Test Structure
51
46
52
47
Each test in `parser/testdata/` contains:
53
48
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).
Tests for unsupported syntax will not have `ast.json` files generated.
62
+
**NEVER modify `explain.txt` files** - These are golden files containing the expected output from ClickHouse. If tests fail due to output mismatches, fix the Go code to match the expected output, not the other way around.
0 commit comments