Add tests

This commit is contained in:
Joshua Warner 2022-02-26 13:33:33 -08:00
parent ab563fc9a5
commit 611d1784a9
7 changed files with 180 additions and 0 deletions

View File

@ -0,0 +1,74 @@
Defs(
[
@0-58 Body(
@0-7 Malformed(
"my_list",
),
@10-58 List(
Collection {
items: [
@16-17 SpaceBefore(
Num(
"0",
),
[
Newline,
],
),
@23-48 SpaceBefore(
List(
Collection {
items: [
@33-34 SpaceBefore(
Var {
module_name: "",
ident: "a",
},
[
Newline,
],
),
@44-45 SpaceBefore(
Var {
module_name: "",
ident: "b",
},
[
Newline,
],
),
],
final_comments: [
Newline,
],
},
),
[
Newline,
],
),
@54-55 SpaceBefore(
Num(
"1",
),
[
Newline,
],
),
],
final_comments: [
Newline,
],
},
),
),
],
@59-61 SpaceBefore(
Num(
"42",
),
[
Newline,
],
),
)

View File

@ -0,0 +1,9 @@
my_list = [
0,
[
a,
b,
],
1,
]
42

View File

@ -0,0 +1,42 @@
Defs(
[
@0-26 Body(
@0-7 Malformed(
"my_list",
),
@10-26 List(
Collection {
items: [
@16-17 SpaceBefore(
Num(
"0",
),
[
Newline,
],
),
@23-24 SpaceBefore(
Num(
"1",
),
[
Newline,
],
),
],
final_comments: [
Newline,
],
},
),
),
],
@27-29 SpaceBefore(
Num(
"42",
),
[
Newline,
],
),
)

View File

@ -0,0 +1,5 @@
my_list = [
0,
1
]
42

View File

@ -0,0 +1,42 @@
Defs(
[
@0-27 Body(
@0-7 Malformed(
"my_list",
),
@10-27 List(
Collection {
items: [
@16-17 SpaceBefore(
Num(
"0",
),
[
Newline,
],
),
@23-24 SpaceBefore(
Num(
"1",
),
[
Newline,
],
),
],
final_comments: [
Newline,
],
},
),
),
],
@28-30 SpaceBefore(
Num(
"42",
),
[
Newline,
],
),
)

View File

@ -0,0 +1,5 @@
my_list = [
0,
1,
]
42

View File

@ -122,6 +122,7 @@ mod test_parse {
snapshot_tests! {
fail/type_argument_no_arrow.expr,
fail/type_double_comma.expr,
pass/list_closing_indent_not_enough.expr,
pass/add_var_with_spaces.expr,
pass/add_with_spaces.expr,
pass/annotated_record_destructure.expr,
@ -167,6 +168,8 @@ mod test_parse {
pass/int_with_underscore.expr,
pass/interface_with_newline.header,
pass/lowest_float.expr,
pass/list_closing_same_indent_no_trailing_comma.expr,
pass/list_closing_same_indent_with_trailing_comma.expr,
pass/lowest_int.expr,
pass/malformed_ident_due_to_underscore.expr,
pass/malformed_pattern_field_access.expr, // See https://github.com/rtfeldman/roc/issues/399