mirror of
https://github.com/Reuh/anselme.git
synced 2025-10-27 16:49:31 +00:00
Third test batch
This commit is contained in:
parent
3edf65dc2a
commit
0eea4b80a6
7 changed files with 131 additions and 1 deletions
|
|
@ -65,7 +65,7 @@ local ScopeStack = class {
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
self:define_overloadable(sym, LuaFunction:new(parameters, func):eval(self.state))
|
self:define_overloadable(sym, LuaFunction:new(parameters, func):eval(self.state))
|
||||||
elseif Node:is(value) then
|
elseif Node:issub(value) then
|
||||||
self:define(sym, value)
|
self:define(sym, value)
|
||||||
else
|
else
|
||||||
self:define(sym, to_anselme(value))
|
self:define(sym, to_anselme(value))
|
||||||
|
|
|
||||||
13
test/results/function custom type dispatch error.ans
Normal file
13
test/results/function custom type dispatch error.ans
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
--# run #--
|
||||||
|
--- text ---
|
||||||
|
| {}"" {}"pierre" {}" is french" |
|
||||||
|
--- text ---
|
||||||
|
| {}"" {}"idk" {}" is esperanto" |
|
||||||
|
--- error ---
|
||||||
|
[0m[31m[0m[31mcan't call overload overload<($(name::($(x) type(x) == t)) _), ($(name::($(x) type(x) == t)) _)>: no function match (type("nope", 5)), possible functions were:
|
||||||
|
• (name::($(x) type(x) == t)): type check failure for parameter name in function (name::($(x) type(x) == t))
|
||||||
|
• (name::($(x) type(x) == t)): type check failure for parameter name in function (name::($(x) type(x) == t))[0m
|
||||||
|
↳ from [4mtest/tests/function custom type dispatch error.ans:14:2[0m in call: [2ma(type(5, "nope"))[0m[0m
|
||||||
|
↳ from [4m?[0m in block: [2m:french name = "french name"…[0m
|
||||||
|
--# saved #--
|
||||||
|
{}
|
||||||
11
test/results/function custom type dispatch.ans
Normal file
11
test/results/function custom type dispatch.ans
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
--# run #--
|
||||||
|
--- text ---
|
||||||
|
| {}"" {}"bob" {}" is english or generic" |
|
||||||
|
--- text ---
|
||||||
|
| {}"" {}"pierre" {}" is french" |
|
||||||
|
--- text ---
|
||||||
|
| {}"" {}"idk" {}" is english or generic" |
|
||||||
|
--- return ---
|
||||||
|
()
|
||||||
|
--# saved #--
|
||||||
|
{}
|
||||||
42
test/results/litterals.ans
Normal file
42
test/results/litterals.ans
Normal file
|
|
@ -0,0 +1,42 @@
|
||||||
|
--# run #--
|
||||||
|
--- text ---
|
||||||
|
| {}"numbers:" |
|
||||||
|
| {}"" {}"0" {}"" |
|
||||||
|
| {}"" {}"12" {}"" |
|
||||||
|
| {}"" {}"0.87" {}"" |
|
||||||
|
| {}"" {}"39.12" {}"" |
|
||||||
|
--- text ---
|
||||||
|
| {}"strings:" |
|
||||||
|
| {}"" {}"foo" {}"" |
|
||||||
|
--- text ---
|
||||||
|
| {}"tuple:" |
|
||||||
|
| {}"" {}"[4, 8, 9]" {}"" |
|
||||||
|
--- text ---
|
||||||
|
| {}"struct:" |
|
||||||
|
| {}"" {}"{1:9, 2:8, 7:4}" {}"" |
|
||||||
|
--- text ---
|
||||||
|
| {}"symbols:" |
|
||||||
|
| {}"" {}":ab" {}"" |
|
||||||
|
--- text ---
|
||||||
|
| {}"anchor:" |
|
||||||
|
| {}"" {}"#jdfe" {}"" |
|
||||||
|
| {}"" {}"#foo bar" {}"" |
|
||||||
|
--- text ---
|
||||||
|
| {}"boolean:" |
|
||||||
|
| {}"" {}"false" {}"" |
|
||||||
|
| {}"" {}"true" {}"" |
|
||||||
|
--- text ---
|
||||||
|
| {}"nil:" |
|
||||||
|
| {}"" {}"()" {}"" |
|
||||||
|
--- text ---
|
||||||
|
| {}"pair:" |
|
||||||
|
| {}"" {}"6:8" {}"" |
|
||||||
|
| {}"" {}"\"d\":[]" {}"" |
|
||||||
|
--- text ---
|
||||||
|
| {}"function:" |
|
||||||
|
| {}"" {}"($() 12)" {}"" |
|
||||||
|
| {}"" {}"($(x) x)" {}"" |
|
||||||
|
--- return ---
|
||||||
|
()
|
||||||
|
--# saved #--
|
||||||
|
{}
|
||||||
14
test/tests/function custom type dispatch error.ans
Normal file
14
test/tests/function custom type dispatch error.ans
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
:french name="french name"
|
||||||
|
:esperanto name="esperanto name"
|
||||||
|
|
||||||
|
:$ a(name::is(esperanto name))
|
||||||
|
|{name!value} is esperanto
|
||||||
|
|
||||||
|
:$ a(name::is(french name))
|
||||||
|
|{name!value} is french
|
||||||
|
|
||||||
|
a("pierre"!type(french name))
|
||||||
|
|
||||||
|
a("idk"!type(esperanto name))
|
||||||
|
|
||||||
|
a(5!type("nope"))
|
||||||
14
test/tests/function custom type dispatch.ans
Normal file
14
test/tests/function custom type dispatch.ans
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
:french name="french name"
|
||||||
|
:esperanto name="esperanto name"
|
||||||
|
|
||||||
|
:$ a(name)
|
||||||
|
|{name!value} is english or generic
|
||||||
|
|
||||||
|
:$ a(name::is(french name))
|
||||||
|
|{name!value} is french
|
||||||
|
|
||||||
|
a("bob")
|
||||||
|
|
||||||
|
a("pierre"!type(french name))
|
||||||
|
|
||||||
|
a("idk"!type(esperanto name))
|
||||||
36
test/tests/litterals.ans
Normal file
36
test/tests/litterals.ans
Normal file
|
|
@ -0,0 +1,36 @@
|
||||||
|
| numbers:
|
||||||
|
| {0}
|
||||||
|
| {12}
|
||||||
|
| {.87}
|
||||||
|
| {39.12}
|
||||||
|
|
||||||
|
| strings:
|
||||||
|
| {"foo"}
|
||||||
|
|
||||||
|
| tuple:
|
||||||
|
| {[4,8,9]}
|
||||||
|
|
||||||
|
| struct:
|
||||||
|
| {{7:4,2:8,1:9}}
|
||||||
|
|
||||||
|
| symbols:
|
||||||
|
| {:ab}
|
||||||
|
|
||||||
|
| anchor:
|
||||||
|
| {#jdfe}
|
||||||
|
| {#foo bar}
|
||||||
|
|
||||||
|
| boolean:
|
||||||
|
| {false}
|
||||||
|
| {true}
|
||||||
|
|
||||||
|
| nil:
|
||||||
|
| {()}
|
||||||
|
|
||||||
|
| pair:
|
||||||
|
| {6:8}
|
||||||
|
| {("d"):([])}
|
||||||
|
|
||||||
|
| function:
|
||||||
|
| {$12}
|
||||||
|
| {$(x)x}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue