Skip to content

Commit

Permalink
add rust test for record wildcards
Browse files Browse the repository at this point in the history
  • Loading branch information
tek committed Apr 19, 2024
1 parent ba8d1fb commit 4284cc2
Showing 1 changed file with 49 additions and 23 deletions.
72 changes: 49 additions & 23 deletions test/rust/parse-test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ fn parse_tests() {
imports (0, 0) - (0, 12)
import (0, 0) - (0, 12)
import (0, 0) - (0, 6) "import"
qualified_module (0, 7) - (0, 12)
module (0, 7) - (0, 8) "A"
module (0, 7) - (0, 12)
module_id (0, 7) - (0, 8) "A"
. (0, 8) - (0, 9) "."
module (0, 9) - (0, 10) "A"
module_id (0, 9) - (0, 10) "A"
. (0, 10) - (0, 11) "."
module (0, 11) - (0, 12) "A"
module_id (0, 11) - (0, 12) "A"
"#;

check(target1, code1);
Expand All @@ -70,9 +70,10 @@ fn parse_tests() {
let target2 = r#"haskell (0, 0) - (0, 11)
declarations (0, 0) - (0, 11)
signature (0, 0) - (0, 11)
( (0, 0) - (0, 1) "("
operator (0, 1) - (0, 5) ".==="
) (0, 5) - (0, 6) ")"
prefix_id (0, 0) - (0, 6)
( (0, 0) - (0, 1) "("
operator (0, 1) - (0, 5) ".==="
) (0, 5) - (0, 6) ")"
:: (0, 7) - (0, 9) "::"
type_name (0, 10) - (0, 11)
type (0, 10) - (0, 11) "A"
Expand All @@ -84,7 +85,7 @@ fn parse_tests() {

let target3 = r#"haskell (0, 0) - (0, 10)
declarations (0, 0) - (0, 10)
function (0, 0) - (0, 10)
bind (0, 0) - (0, 10)
variable (0, 0) - (0, 1) "a"
= (0, 2) - (0, 3) "="
exp_infix (0, 4) - (0, 10)
Expand All @@ -102,11 +103,12 @@ fn parse_tests() {
let target4 = r##"haskell (0, 0) - (0, 9)
declarations (0, 0) - (0, 9)
signature (0, 0) - (0, 9)
( (0, 0) - (0, 1) "("
operator (0, 1) - (0, 3)
# (0, 1) - (0, 2) "#"
| (0, 2) - (0, 3) "|"
) (0, 3) - (0, 4) ")"
prefix_id (0, 0) - (0, 4)
( (0, 0) - (0, 1) "("
operator (0, 1) - (0, 3)
# (0, 1) - (0, 2) "#"
| (0, 2) - (0, 3) "|"
) (0, 3) - (0, 4) ")"
:: (0, 5) - (0, 7) "::"
type_name (0, 8) - (0, 9)
type (0, 8) - (0, 9) "A"
Expand All @@ -119,9 +121,10 @@ fn parse_tests() {
let target5 = r##"haskell (0, 0) - (0, 9)
declarations (0, 0) - (0, 9)
signature (0, 0) - (0, 9)
( (0, 0) - (0, 1) "("
operator (0, 1) - (0, 3) "|#"
) (0, 3) - (0, 4) ")"
prefix_id (0, 0) - (0, 4)
( (0, 0) - (0, 1) "("
operator (0, 1) - (0, 3) "|#"
) (0, 3) - (0, 4) ")"
:: (0, 5) - (0, 7) "::"
type_name (0, 8) - (0, 9)
type (0, 8) - (0, 9) "A"
Expand All @@ -134,10 +137,11 @@ fn parse_tests() {
let target6 = r##"haskell (0, 0) - (0, 8)
declarations (0, 0) - (0, 8)
signature (0, 0) - (0, 8)
( (0, 0) - (0, 1) "("
operator (0, 1) - (0, 2)
# (0, 1) - (0, 2) "#"
) (0, 2) - (0, 3) ")"
prefix_id (0, 0) - (0, 3)
( (0, 0) - (0, 1) "("
operator (0, 1) - (0, 2)
# (0, 1) - (0, 2) "#"
) (0, 2) - (0, 3) ")"
:: (0, 4) - (0, 6) "::"
type_name (0, 7) - (0, 8)
type (0, 7) - (0, 8) "A"
Expand All @@ -149,7 +153,7 @@ fn parse_tests() {

let target7 = r###"haskell (0, 0) - (0, 10)
declarations (0, 0) - (0, 10)
function (0, 0) - (0, 10)
bind (0, 0) - (0, 10)
variable (0, 0) - (0, 1) "a"
= (0, 2) - (0, 3) "="
exp_infix (0, 4) - (0, 10)
Expand All @@ -168,7 +172,7 @@ fn parse_tests() {

let target8 = r###"haskell (0, 0) - (0, 15)
declarations (0, 0) - (0, 15)
function (0, 0) - (0, 15)
bind (0, 0) - (0, 15)
variable (0, 0) - (0, 1) "a"
= (0, 2) - (0, 3) "="
exp_unboxed_tuple (0, 4) - (0, 15)
Expand All @@ -190,7 +194,7 @@ fn parse_tests() {

let target9 = r#"haskell (0, 0) - (0, 12)
declarations (0, 0) - (0, 12)
function (0, 0) - (0, 12)
bind (0, 0) - (0, 12)
variable (0, 0) - (0, 1) "a"
= (0, 2) - (0, 3) "="
exp_do (0, 4) - (0, 12)
Expand All @@ -203,4 +207,26 @@ fn parse_tests() {
"#;

check(target9, code9);

let code10 = "a A {..} = a";

let target10 = r#"haskell (0, 0) - (0, 12)
declarations (0, 0) - (0, 12)
function (0, 0) - (0, 12)
variable (0, 0) - (0, 1) "a"
patterns (0, 2) - (0, 8)
pat_record (0, 2) - (0, 8)
pat_name (0, 2) - (0, 3)
constructor (0, 2) - (0, 3) "A"
pat_fields (0, 4) - (0, 8)
{ (0, 4) - (0, 5) "{"
pat_field (0, 5) - (0, 7)
wildcard (0, 5) - (0, 7) ".."
} (0, 7) - (0, 8) "}"
= (0, 9) - (0, 10) "="
exp_name (0, 11) - (0, 12)
variable (0, 11) - (0, 12) "a"
"#;

check(target10, code10);
}

0 comments on commit 4284cc2

Please sign in to comment.