aboutsummaryrefslogtreecommitdiffstats
path: root/spec/core
diff options
context:
space:
mode:
authors-ol <s-ol@users.noreply.github.com>2020-03-01 17:44:56 +0000
committers-ol <s-ol@users.noreply.github.com>2020-03-01 17:46:04 +0000
commita1312100fad100190e20b1b3443b5cd962dc8999 (patch)
tree8fc6194fc4b326ee39a9ca6d798cd208664f5fc3 /spec/core
parentadd type-pattern matching language (diff)
downloadalive-a1312100fad100190e20b1b3443b5cd962dc8999.tar.gz
alive-a1312100fad100190e20b1b3443b5cd962dc8999.zip
new op interface part one
Diffstat (limited to 'spec/core')
-rw-r--r--spec/core/pattern_spec.moon26
1 files changed, 13 insertions, 13 deletions
diff --git a/spec/core/pattern_spec.moon b/spec/core/pattern_spec.moon
index ee56634..c218dd2 100644
--- a/spec/core/pattern_spec.moon
+++ b/spec/core/pattern_spec.moon
@@ -4,7 +4,7 @@ import Result, Value from require 'core.value'
-- wrap in non-const result
wrap = (value) ->
with Result :value
- .all_impulses = { 'fake' }
+ .side_inputs = { 'fake' }
-- wrap in const result
wrap_const = (value) -> Result :value
@@ -157,9 +157,9 @@ describe 'match', ->
c_str = wrap_const Value.str 'hello'
it 'matches lists', ->
- assert.is.same {num, num, str}, {match 'num num str', {num, num, str}}
- assert.is.same {num, str}, {match 'num str', {num, str}}
- assert.is.same {c_num, str}, {match '=num str', {c_num, str}}
+ assert.is.same {num, num, str}, match 'num num str', {num, num, str}
+ assert.is.same {num, str}, match 'num str', {num, str}
+ assert.is.same {c_num, str}, match '=num str', {c_num, str}
it 'throws type errors', ->
assert.has.error -> match 'str num str', {num, num, str}
@@ -172,18 +172,18 @@ describe 'match', ->
assert.has.error -> match '*num', {num, num, str}
it 'matches optional arguments', ->
- assert.is.same {str, num, str}, {match 'str num? str', {str, num, str}}
- assert.is.same {str, false, str}, {match 'str num? str', {str, str}}
- assert.is.same {str, false}, {match 'str num?', {str}}
+ assert.is.same {str, num, str}, match 'str num? str', {str, num, str}
+ assert.is.same {str, nil, str}, match 'str num? str', {str, str}
+ assert.is.same {str, nil}, match 'str num?', {str}
it 'matches splats', ->
- assert.is.same {{c_str, str, str}, num}, {match '*str num', {c_str, str, str, num}}
- assert.is.same {c_str, {str, str}}, {match 'any? *str', {c_str, str, str}}
+ assert.is.same {{c_str, str, str}, num}, match '*str num', {c_str, str, str, num}
+ assert.is.same {c_str, {str, str}}, match 'any? *str', {c_str, str, str}
assert.has.error -> match '*str num', {num}
assert.has.error -> match 'any? *str', {str}
it 'matches optional splats', ->
- assert.is.same {{c_str, str, str}, num}, {match '*str? num', {c_str, str, str, num}}
- assert.is.same {c_str, {str, str}}, {match 'any? *str?', {c_str, str, str}}
- assert.is.same {{}, num}, {match '*str? num', {num}}
- assert.is.same {str, {}}, {match 'any? *str?', {str}}
+ assert.is.same {{c_str, str, str}, num}, match '*str? num', {c_str, str, str, num}
+ assert.is.same {c_str, {str, str}}, match 'any? *str?', {c_str, str, str}
+ assert.is.same {{}, num}, match '*str? num', {num}
+ assert.is.same {str, {}}, match 'any? *str?', {str}