aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authors-ol <s-ol@users.noreply.github.com>2020-05-21 15:00:38 +0000
committers-ol <s+removethis@s-ol.nu>2025-03-02 14:24:49 +0000
commit940db8b30ea2455977133be9f09936ed84163143 (patch)
tree8dbd640e48367fa1e6057dcbf893fa4512db0838 /spec
parentsmall internal doc fixes (diff)
downloadalive-940db8b30ea2455977133be9f09936ed84163143.tar.gz
alive-940db8b30ea2455977133be9f09936ed84163143.zip
base.match: fix bug when repeating multi-element patterns
Diffstat (limited to 'spec')
-rw-r--r--spec/match_spec.moon9
1 files changed, 9 insertions, 0 deletions
diff --git a/spec/match_spec.moon b/spec/match_spec.moon
index 9764d5d..0047fd4 100644
--- a/spec/match_spec.moon
+++ b/spec/match_spec.moon
@@ -263,6 +263,15 @@ describe 'repeat', ->
assert.has.error -> rep\match (times 3, str)
assert.has.error -> rep\match (times 2, num)
+ it 'works with complex inner types', ->
+ rep = (val.num + val.str)\rep 2, 2
+ assert.has.error -> rep\match {}
+ assert.has.error -> rep\match {num, str}
+ assert.has.error -> rep\match {num, num}
+ assert.is.same {{num, str}, {num, str}}, rep\match {num, str, num, str}
+ assert.has.error -> rep\match {str, str, str, str}
+ assert.has.error -> rep\match {num, str, num, str, num, str}
+
it 'stringifies well', ->
assert.is.equal 'str~{1-3}', tostring val.str*3
assert.is.equal 'str~{1-*}', tostring val.str*0