From baf807ca2df7e5fb9f5a42b487309efe7ed9f20c Mon Sep 17 00:00:00 2001 From: rvcas Date: Sat, 1 Jul 2023 15:00:48 -0400 Subject: [PATCH] test(parser): list spread --- crates/aiken-lang/src/parser/expr/list.rs | 5 ++++ .../parser/expr/snapshots/list_spread.snap | 30 +++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 crates/aiken-lang/src/parser/expr/snapshots/list_spread.snap diff --git a/crates/aiken-lang/src/parser/expr/list.rs b/crates/aiken-lang/src/parser/expr/list.rs index 69dd4b22..8e76eb9f 100644 --- a/crates/aiken-lang/src/parser/expr/list.rs +++ b/crates/aiken-lang/src/parser/expr/list.rs @@ -44,4 +44,9 @@ mod tests { fn int_list() { assert_expr!("[1, 2, 3]"); } + + #[test] + fn list_spread() { + assert_expr!("[1, 2, ..[]]"); + } } diff --git a/crates/aiken-lang/src/parser/expr/snapshots/list_spread.snap b/crates/aiken-lang/src/parser/expr/snapshots/list_spread.snap new file mode 100644 index 00000000..2009bc42 --- /dev/null +++ b/crates/aiken-lang/src/parser/expr/snapshots/list_spread.snap @@ -0,0 +1,30 @@ +--- +source: crates/aiken-lang/src/parser/expr/list.rs +description: "Code:\n\n[1, 2, ..[]]" +--- +List { + location: 0..12, + elements: [ + Int { + location: 1..2, + value: "1", + base: Decimal { + numeric_underscore: false, + }, + }, + Int { + location: 4..5, + value: "2", + base: Decimal { + numeric_underscore: false, + }, + }, + ], + tail: Some( + List { + location: 9..11, + elements: [], + tail: None, + }, + ), +}