diff options
| author | s-ol <s-ol@users.noreply.github.com> | 2020-05-21 15:00:38 +0000 |
|---|---|---|
| committer | s-ol <s-ol@users.noreply.github.com> | 2020-05-21 15:00:38 +0000 |
| commit | 267ed9a1a6848e7bf7ef7707b7d71c8ee4181e29 (patch) | |
| tree | f57bb486c2148032e11e8607f6994f64826abf73 /spec | |
| parent | small internal doc fixes (diff) | |
| download | alive-267ed9a1a6848e7bf7ef7707b7d71c8ee4181e29.tar.gz alive-267ed9a1a6848e7bf7ef7707b7d71c8ee4181e29.zip | |
base.match: fix bug when repeating multi-element patterns
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/match_spec.moon | 9 |
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 |
