-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add snapshot testing for AST pretty printing
- Loading branch information
Showing
22 changed files
with
1,126 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
partiql-ast/tests/snapshots/pretty__having_limit_offset.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
--- | ||
source: partiql-ast/tests/pretty.rs | ||
expression: doc | ||
--- | ||
======================================================================================================================================================================================================== | ||
SELECT a FROM foo GROUP BY a HAVING a > 2 ORDER BY a LIMIT 1 OFFSET 1 | ||
======================================================================================================================================================================================================== | ||
|
||
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ||
SELECT a FROM foo GROUP BY a HAVING (a > 2) ORDER BY a LIMIT 1 OFFSET 1 | ||
|
||
------------------------------------------------------------------------------------------------------------------------ | ||
SELECT a FROM foo GROUP BY a HAVING (a > 2) ORDER BY a LIMIT 1 OFFSET 1 | ||
|
||
-------------------------------------------------------------------------------- | ||
SELECT a FROM foo GROUP BY a HAVING (a > 2) ORDER BY a LIMIT 1 OFFSET 1 | ||
|
||
---------------------------------------- | ||
SELECT a FROM foo GROUP BY a | ||
HAVING (a > 2) ORDER BY a LIMIT 1 | ||
OFFSET 1 | ||
|
||
------------------------------ | ||
SELECT a FROM foo GROUP BY a | ||
HAVING (a > 2) ORDER BY a | ||
LIMIT 1 OFFSET 1 | ||
|
||
-------------------- | ||
SELECT a FROM foo | ||
GROUP BY a | ||
HAVING (a > 2) | ||
ORDER BY a LIMIT 1 | ||
OFFSET 1 | ||
|
||
---------- | ||
SELECT a | ||
FROM foo | ||
GROUP BY a | ||
HAVING (a > 2) | ||
ORDER BY a | ||
LIMIT 1 | ||
OFFSET 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,149 @@ | ||
--- | ||
source: partiql-ast/tests/pretty.rs | ||
expression: doc | ||
--- | ||
======================================================================================================================================================================================================== | ||
select foo,bar, baz,thud.*,grunt.a[*].b[2].*, count(1) as n from | ||
<< | ||
{ 'foo': 'foo', 'x': 9, 'y':5, z:-11 }, | ||
{ 'foo': 'bar' }, | ||
{ 'foo': 'qux' }, | ||
{ 'foo': 'bar' }, | ||
{ 'foo': 'baz' }, | ||
{ 'foo': 'bar' }, | ||
{ 'foo': 'baz' } | ||
>> group by foo order by n desc | ||
======================================================================================================================================================================================================== | ||
|
||
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ||
SELECT foo, bar, baz, thud.*, grunt.a[*].b[2].*, count(1) AS n FROM << | ||
{ 'foo': 'foo', 'x': 9, 'y': 5, z: -11 }, | ||
{ 'foo': 'bar' }, | ||
{ 'foo': 'qux' }, | ||
{ 'foo': 'bar' }, | ||
{ 'foo': 'baz' }, | ||
{ 'foo': 'bar' }, | ||
{ 'foo': 'baz' } | ||
>> GROUP BY foo ORDER BY n DESC | ||
|
||
------------------------------------------------------------------------------------------------------------------------ | ||
SELECT foo, bar, baz, thud.*, grunt.a[*].b[2].*, count(1) AS n FROM << | ||
{ 'foo': 'foo', 'x': 9, 'y': 5, z: -11 }, | ||
{ 'foo': 'bar' }, | ||
{ 'foo': 'qux' }, | ||
{ 'foo': 'bar' }, | ||
{ 'foo': 'baz' }, | ||
{ 'foo': 'bar' }, | ||
{ 'foo': 'baz' } | ||
>> GROUP BY foo ORDER BY n DESC | ||
|
||
-------------------------------------------------------------------------------- | ||
SELECT foo, bar, baz, thud.*, grunt.a[*].b[2].*, count(1) AS n FROM << | ||
{ 'foo': 'foo', 'x': 9, 'y': 5, z: -11 }, | ||
{ 'foo': 'bar' }, | ||
{ 'foo': 'qux' }, | ||
{ 'foo': 'bar' }, | ||
{ 'foo': 'baz' }, | ||
{ 'foo': 'bar' }, | ||
{ 'foo': 'baz' } | ||
>> GROUP BY foo ORDER BY n DESC | ||
|
||
---------------------------------------- | ||
SELECT foo, bar, baz, thud.*, | ||
grunt.a[*].b[2].*, count(1) AS n | ||
FROM << | ||
{ | ||
'foo': 'foo', | ||
'x': 9, | ||
'y': 5, | ||
z: -11 | ||
}, | ||
{ 'foo': 'bar' }, | ||
{ 'foo': 'qux' }, | ||
{ 'foo': 'bar' }, | ||
{ 'foo': 'baz' }, | ||
{ 'foo': 'bar' }, | ||
{ 'foo': 'baz' } | ||
>> GROUP BY foo ORDER BY n DESC | ||
|
||
------------------------------ | ||
SELECT foo, bar, baz, thud.*, | ||
grunt.a[*].b[2].*, | ||
count(1) AS n FROM << | ||
{ | ||
'foo': 'foo', | ||
'x': 9, | ||
'y': 5, | ||
z: -11 | ||
}, | ||
{ 'foo': 'bar' }, | ||
{ 'foo': 'qux' }, | ||
{ 'foo': 'bar' }, | ||
{ 'foo': 'baz' }, | ||
{ 'foo': 'bar' }, | ||
{ 'foo': 'baz' } | ||
>> GROUP BY foo | ||
ORDER BY n DESC | ||
|
||
-------------------- | ||
SELECT foo, bar, | ||
baz, thud.*, | ||
grunt.a[*].b[2].*, | ||
count(1) AS n | ||
FROM << | ||
{ | ||
'foo': 'foo', | ||
'x': 9, | ||
'y': 5, | ||
z: -11 | ||
}, | ||
{ 'foo': 'bar' | ||
}, | ||
{ 'foo': 'qux' | ||
}, | ||
{ 'foo': 'bar' | ||
}, | ||
{ 'foo': 'baz' | ||
}, | ||
{ 'foo': 'bar' | ||
}, | ||
{ 'foo': 'baz' } | ||
>> GROUP BY foo | ||
ORDER BY n DESC | ||
|
||
---------- | ||
SELECT foo, | ||
bar, | ||
baz, | ||
thud.*, | ||
grunt.a[*].b[2].*, | ||
count(1) AS n | ||
FROM << | ||
{ | ||
'foo': 'foo', | ||
'x': 9, | ||
'y': 5, | ||
z: -11 | ||
}, | ||
{ | ||
'foo': 'bar' | ||
}, | ||
{ | ||
'foo': 'qux' | ||
}, | ||
{ | ||
'foo': 'bar' | ||
}, | ||
{ | ||
'foo': 'baz' | ||
}, | ||
{ | ||
'foo': 'bar' | ||
}, | ||
{ | ||
'foo': 'baz' | ||
} | ||
>> | ||
GROUP BY | ||
foo | ||
ORDER BY n DESC |
Oops, something went wrong.