1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
use grammar;
// This test file is designed to fail compilation if the spans are incorrect.
// We use `trybuild` style testing logic manually by checking if errors point to the right place.
// Since we can't easily assert on span locations in runtime tests without a complex setup,
// we rely on the fact that if `quote_spanned!` is working, the generated code will have the right spans.
//
// However, to verify the fix for "errors pointing to grammar!", we can check if `syn::Error`s
// generated during *runtime parsing* (which use the spans we propagated) have reasonable locations
// if we were to inspect them. But `syn::Error` spans are not easily inspectable for line/column in tests.
//
// Instead, we trust that by propagating the spans in `ModelPattern`, `quote_spanned!` in `codegen`
// will attach the right span to the generated code.
//
// We can at least verify that the code compiles and runs, ensuring our refactoring didn't break anything.