Skip to content

Commit 7e58c4d

Browse files
authored
Merge pull request #87 from cvng/feat/snap-test
feat: add snapshots test back
2 parents eccfe1c + fe7e516 commit 7e58c4d

File tree

84 files changed

+16354
-21
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+16354
-21
lines changed

Diff for: crates/parser/tests/snapshots/statements/valid/[email protected]

+330
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
---
2+
source: crates/parser/tests/statement_parser_test.rs
3+
description: "COPY weather FROM '/home/user/weather.txt';"
4+
---
5+
Parse {
6+
cst: SourceFile@0..43
7+
CopyStmt@0..43
8+
Copy@0..4 "COPY"
9+
Whitespace@4..5 " "
10+
RangeVar@5..12
11+
Ident@5..12 "weather"
12+
Whitespace@12..13 " "
13+
From@13..17 "FROM"
14+
Whitespace@17..18 " "
15+
Sconst@18..42 "'/home/user/weather.txt'"
16+
Ascii59@42..43 ";"
17+
,
18+
errors: [],
19+
stmts: [
20+
RawStmt {
21+
stmt: CopyStmt(
22+
CopyStmt {
23+
relation: Some(
24+
RangeVar {
25+
catalogname: "",
26+
schemaname: "",
27+
relname: "weather",
28+
inh: true,
29+
relpersistence: "p",
30+
alias: None,
31+
location: 5,
32+
},
33+
),
34+
query: None,
35+
attlist: [],
36+
is_from: true,
37+
is_program: false,
38+
filename: "/home/user/weather.txt",
39+
options: [],
40+
where_clause: None,
41+
},
42+
),
43+
range: 0..42,
44+
},
45+
],
46+
}

Diff for: crates/parser/tests/snapshots/statements/valid/[email protected]

+453
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,253 @@
1+
---
2+
source: crates/parser/tests/statement_parser_test.rs
3+
description: "CREATE VIEW myview AS\n SELECT name, location\n FROM weather, cities\n WHERE city = name;"
4+
---
5+
Parse {
6+
cst: SourceFile@0..99
7+
Create@0..6 "CREATE"
8+
Whitespace@6..7 " "
9+
View@7..11 "VIEW"
10+
Whitespace@11..12 " "
11+
Ident@12..18 "myview"
12+
Whitespace@18..19 " "
13+
As@19..21 "AS"
14+
Newline@21..22 "\n"
15+
SelectStmt@22..99
16+
Select@22..28 "SELECT"
17+
Whitespace@28..29 " "
18+
ResTarget@29..33
19+
ColumnRef@29..33
20+
NameP@29..33 "name"
21+
Ascii44@33..34 ","
22+
Whitespace@34..35 " "
23+
ResTarget@35..43
24+
ColumnRef@35..43
25+
Location@35..43 "location"
26+
Newline@43..44 "\n"
27+
Whitespace@44..52 " "
28+
From@52..56 "FROM"
29+
Whitespace@56..57 " "
30+
RangeVar@57..64
31+
Ident@57..64 "weather"
32+
Ascii44@64..65 ","
33+
Whitespace@65..66 " "
34+
RangeVar@66..72
35+
Ident@66..72 "cities"
36+
Newline@72..73 "\n"
37+
Whitespace@73..81 " "
38+
Where@81..86 "WHERE"
39+
Whitespace@86..87 " "
40+
AExpr@87..98
41+
ColumnRef@87..91
42+
Ident@87..91 "city"
43+
Whitespace@91..92 " "
44+
Ascii61@92..93 "="
45+
Whitespace@93..94 " "
46+
ColumnRef@94..98
47+
NameP@94..98 "name"
48+
Ascii59@98..99 ";"
49+
,
50+
errors: [
51+
SyntaxError(
52+
"Expected Ascii59, found Whitespace",
53+
22..22,
54+
),
55+
SyntaxError(
56+
"Invalid statement: syntax error at end of input",
57+
0..8,
58+
),
59+
],
60+
stmts: [
61+
RawStmt {
62+
stmt: SelectStmt(
63+
SelectStmt {
64+
distinct_clause: [],
65+
into_clause: None,
66+
target_list: [
67+
Node {
68+
node: Some(
69+
ResTarget(
70+
ResTarget {
71+
name: "",
72+
indirection: [],
73+
val: Some(
74+
Node {
75+
node: Some(
76+
ColumnRef(
77+
ColumnRef {
78+
fields: [
79+
Node {
80+
node: Some(
81+
String(
82+
String {
83+
sval: "name",
84+
},
85+
),
86+
),
87+
},
88+
],
89+
location: 7,
90+
},
91+
),
92+
),
93+
},
94+
),
95+
location: 7,
96+
},
97+
),
98+
),
99+
},
100+
Node {
101+
node: Some(
102+
ResTarget(
103+
ResTarget {
104+
name: "",
105+
indirection: [],
106+
val: Some(
107+
Node {
108+
node: Some(
109+
ColumnRef(
110+
ColumnRef {
111+
fields: [
112+
Node {
113+
node: Some(
114+
String(
115+
String {
116+
sval: "location",
117+
},
118+
),
119+
),
120+
},
121+
],
122+
location: 13,
123+
},
124+
),
125+
),
126+
},
127+
),
128+
location: 13,
129+
},
130+
),
131+
),
132+
},
133+
],
134+
from_clause: [
135+
Node {
136+
node: Some(
137+
RangeVar(
138+
RangeVar {
139+
catalogname: "",
140+
schemaname: "",
141+
relname: "weather",
142+
inh: true,
143+
relpersistence: "p",
144+
alias: None,
145+
location: 35,
146+
},
147+
),
148+
),
149+
},
150+
Node {
151+
node: Some(
152+
RangeVar(
153+
RangeVar {
154+
catalogname: "",
155+
schemaname: "",
156+
relname: "cities",
157+
inh: true,
158+
relpersistence: "p",
159+
alias: None,
160+
location: 44,
161+
},
162+
),
163+
),
164+
},
165+
],
166+
where_clause: Some(
167+
Node {
168+
node: Some(
169+
AExpr(
170+
AExpr {
171+
kind: AexprOp,
172+
name: [
173+
Node {
174+
node: Some(
175+
String(
176+
String {
177+
sval: "=",
178+
},
179+
),
180+
),
181+
},
182+
],
183+
lexpr: Some(
184+
Node {
185+
node: Some(
186+
ColumnRef(
187+
ColumnRef {
188+
fields: [
189+
Node {
190+
node: Some(
191+
String(
192+
String {
193+
sval: "city",
194+
},
195+
),
196+
),
197+
},
198+
],
199+
location: 65,
200+
},
201+
),
202+
),
203+
},
204+
),
205+
rexpr: Some(
206+
Node {
207+
node: Some(
208+
ColumnRef(
209+
ColumnRef {
210+
fields: [
211+
Node {
212+
node: Some(
213+
String(
214+
String {
215+
sval: "name",
216+
},
217+
),
218+
),
219+
},
220+
],
221+
location: 72,
222+
},
223+
),
224+
),
225+
},
226+
),
227+
location: 70,
228+
},
229+
),
230+
),
231+
},
232+
),
233+
group_clause: [],
234+
group_distinct: false,
235+
having_clause: None,
236+
window_clause: [],
237+
values_lists: [],
238+
sort_clause: [],
239+
limit_offset: None,
240+
limit_count: None,
241+
limit_option: Default,
242+
locking_clause: [],
243+
with_clause: None,
244+
op: SetopNone,
245+
all: false,
246+
larg: None,
247+
rarg: None,
248+
},
249+
),
250+
range: 25..102,
251+
},
252+
],
253+
}

0 commit comments

Comments
 (0)