Skip to content

Commit

Permalink
patch tests
Browse files Browse the repository at this point in the history
  • Loading branch information
MarinPostma committed Oct 29, 2022
1 parent 22e07aa commit 64cfd77
Showing 1 changed file with 21 additions and 27 deletions.
48 changes: 21 additions & 27 deletions prql-compiler/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,6 @@ mod test {
}

#[test]
#[ignore]
fn test_quoting() {
// GH-#822
assert_display_snapshot!((compile(r###"
Expand All @@ -238,7 +237,7 @@ join some_schema.tablename [~id]
"###).unwrap()), @r###"
WITH "UPPER" AS (
SELECT
lower.*
*
FROM
lower
)
Expand Down Expand Up @@ -287,7 +286,7 @@ select `first name`

assert_display_snapshot!((compile(query).unwrap()), @r###"
SELECT
invoices.*
*
FROM
invoices
ORDER BY
Expand All @@ -298,7 +297,6 @@ select `first name`
}

#[test]
#[ignore]
fn test_ranges() {
let query = r###"
from employees
Expand All @@ -307,7 +305,7 @@ select `first name`

assert_display_snapshot!((compile(query).unwrap()), @r###"
SELECT
employees.*
*
FROM
employees
WHERE
Expand All @@ -329,7 +327,7 @@ select `first name`

assert_display_snapshot!((compile(query).unwrap()), @r###"
SELECT
events.*
*
FROM
events
WHERE
Expand All @@ -339,7 +337,6 @@ select `first name`
}

#[test]
#[ignore]
fn test_interval() {
let query = r###"
from projects
Expand All @@ -348,7 +345,7 @@ select `first name`

assert_display_snapshot!((compile(query).unwrap()), @r###"
SELECT
projects.*,
*,
start + INTERVAL 10 DAY AS first_check_in
FROM
projects
Expand All @@ -367,7 +364,7 @@ select `first name`
]
"###).unwrap()), @r###"
SELECT
to_do_empty_table.*,
*,
DATE '2011-02-01' AS date,
TIMESTAMP '2011-02-01T10:00' AS timestamp,
TIME '14:00' AS time
Expand Down Expand Up @@ -642,7 +639,6 @@ select `first name`
}

#[test]
#[ignore]
fn test_filter() {
// https://github.com/prql/prql/issues/469
let query = r###"
Expand All @@ -657,7 +653,7 @@ select `first name`
filter age > 25 and age < 40
"###).unwrap()), @r###"
SELECT
employees.*
*
FROM
employees
WHERE
Expand All @@ -671,7 +667,7 @@ select `first name`
filter age < 40
"###).unwrap()), @r###"
SELECT
employees.*
*
FROM
employees
WHERE
Expand All @@ -681,7 +677,6 @@ select `first name`
}

#[test]
#[ignore]
fn test_nulls() {
assert_display_snapshot!((compile(r###"
from employees
Expand All @@ -699,7 +694,7 @@ select `first name`
derive amount = amount + 2 ?? 3 * 5
"###).unwrap()), @r###"
SELECT
employees.*,
*,
COALESCE(amount + 2, 3 * 5) AS amount
FROM
employees
Expand All @@ -711,7 +706,7 @@ select `first name`
filter first_name == null and null == last_name
"###).unwrap()), @r###"
SELECT
employees.*
*
FROM
employees
WHERE
Expand All @@ -725,7 +720,7 @@ select `first name`
filter first_name != null and null != last_name
"###).unwrap()), @r###"
SELECT
employees.*
*
FROM
employees
WHERE
Expand All @@ -742,7 +737,7 @@ select `first name`
take ..10
"###).unwrap()), @r###"
SELECT
employees.*
*
FROM
employees
LIMIT
Expand All @@ -754,7 +749,7 @@ select `first name`
take 5..10
"###).unwrap()), @r###"
SELECT
employees.*
*
FROM
employees
LIMIT
Expand All @@ -766,7 +761,7 @@ select `first name`
take 5..
"###).unwrap()), @r###"
SELECT
employees.*
*
FROM
employees OFFSET 4
"###);
Expand All @@ -776,7 +771,7 @@ select `first name`
take 5..5
"###).unwrap()), @r###"
SELECT
employees.*
*
FROM
employees
LIMIT
Expand All @@ -790,7 +785,7 @@ select `first name`
take 1..5
"###).unwrap()), @r###"
SELECT
employees.*
*
FROM
employees
LIMIT
Expand Down Expand Up @@ -1434,15 +1429,14 @@ take 20

assert_display_snapshot!((compile(query).unwrap()), @r###"
SELECT
github_json.*,
github_json.`event.type` AS event_type_dotted
*,
`event.type` AS event_type_dotted
FROM
github_json
"###);
}

#[test]
#[ignore]
fn test_ident_escaping() {
// Generic
let query = r###"
Expand All @@ -1452,7 +1446,7 @@ take 20

assert_display_snapshot!((compile(query).unwrap()), @r###"
SELECT
"anim""ls".*,
*,
"BeeName" AS "čebela",
"bear's_name" AS medved
FROM
Expand All @@ -1469,7 +1463,7 @@ take 20

assert_display_snapshot!((compile(query).unwrap()), @r###"
SELECT
`anim"ls`.*,
*,
`BeeName` AS `čebela`,
`bear's_name` AS medved
FROM
Expand All @@ -1488,7 +1482,7 @@ take 20
assert_display_snapshot!(sql,
@r###"
SELECT
employees.*,
*,
true AS always_true
FROM
employees
Expand Down

0 comments on commit 64cfd77

Please sign in to comment.