mirror of
https://github.com/Reuh/anselme.git
synced 2025-10-27 16:49:31 +00:00
Update tests
This commit is contained in:
parent
a79b054bfb
commit
a85e7ab0af
73 changed files with 246 additions and 157 deletions
38
anselme/state/calling_environment_manager.lua
Normal file
38
anselme/state/calling_environment_manager.lua
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
local class = require("anselme.lib.class")
|
||||
|
||||
local ast = require("anselme.ast")
|
||||
local Identifier
|
||||
|
||||
-- stack of resumable contexts
|
||||
local calling_env_identifier, calling_env_symbol
|
||||
|
||||
local calling_environment_manager = class {
|
||||
init = false,
|
||||
|
||||
push = function(self, state, calling_environment)
|
||||
state.scope:push_partial(calling_env_identifier)
|
||||
state.scope:define(calling_env_symbol, calling_environment)
|
||||
end,
|
||||
pop = function(self, state)
|
||||
state.scope:pop()
|
||||
end,
|
||||
|
||||
get_level = function(self, state, level)
|
||||
local env = state.scope:capture()
|
||||
while level > 0 do
|
||||
assert(env:defined(state, calling_env_identifier), "no calling function")
|
||||
env = env:get(state, calling_env_identifier)
|
||||
level = level - 1
|
||||
end
|
||||
return env
|
||||
end,
|
||||
}
|
||||
|
||||
package.loaded[...] = calling_environment_manager
|
||||
|
||||
Identifier = ast.Identifier
|
||||
|
||||
calling_env_identifier = Identifier:new("_calling_environment")
|
||||
calling_env_symbol = calling_env_identifier:to_symbol()
|
||||
|
||||
return calling_environment_manager
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
--- text ---
|
||||
| {}"" {}"type(\"kg\", 12)" {}"" |
|
||||
--- error ---
|
||||
[0m[31m[0m[31mtype check failure for weigh; 32 does not satisfy ($(x) type(x) == t)[0m
|
||||
[0m[31m[0m[31mtype check failure for weigh; 32 does not satisfy $(x) type(x) == t[0m
|
||||
↳ from [4mtest/tests/constrained variable assignement.ans:9:7[0m in assignment: [2mweigh = 32[0m[0m
|
||||
↳ from [4m?[0m in block: [2m:weigh::is("kg") = type(5, "kg")…[0m
|
||||
--# saved #--
|
||||
|
|
|
|||
7
test/results/default attached block.ans
Normal file
7
test/results/default attached block.ans
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
--# run #--
|
||||
--- text ---
|
||||
| {}"ok" |
|
||||
--- return ---
|
||||
()
|
||||
--# saved #--
|
||||
{"fn.checkpoint":false, "fn.run":1}
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
--- text ---
|
||||
| {}"" {}"42" {}"" |
|
||||
--- error ---
|
||||
[0m[31m[0m[31m[0m[31m[0m[31midentifier "z" is undefined in branch 1228bcf1-5118-4955-10048-8fda790007be[0m
|
||||
[0m[31m[0m[31m[0m[31m[0m[31midentifier "z" is undefined in branch cf017f8a-7c86-4871-109af-6658231331e6[0m
|
||||
↳ from [4mtest/tests/exported variable nested.ans:12:3[0m in identifier: [2mz[0m[0m
|
||||
↳ from [4mtest/tests/exported variable nested.ans:12:1[0m in text interpolation: [2m| {z} |[0m[0m
|
||||
↳ from [4mtest/tests/exported variable nested.ans:12:1[0m in translatable: [2m| {z} |[0m[0m
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
--# run #--
|
||||
--- error ---
|
||||
[0m[31m[0m[31mcan't call closure ($(a, b) _): expected 2 arguments, received 1[0m
|
||||
[0m[31m[0m[31mcan't call function $(a, b) _: expected 2 arguments, received 1[0m
|
||||
↳ from [4mtest/tests/function args arity check fail.ans:4:2[0m in call: [2mf("ok")[0m[0m
|
||||
↳ from [4m?[0m in block: [2m:f = ($(a, b) _)…[0m
|
||||
--# saved #--
|
||||
|
|
|
|||
|
|
@ -2,14 +2,14 @@
|
|||
--- text ---
|
||||
| {}"c" |
|
||||
--- text ---
|
||||
| {}"a" |
|
||||
--- text ---
|
||||
| {}"c" |
|
||||
| {}"b" |
|
||||
--- text ---
|
||||
| {}"a" |
|
||||
--- text ---
|
||||
| {}"b" |
|
||||
--- text ---
|
||||
| {}"b" |
|
||||
--- return ---
|
||||
()
|
||||
--# saved #--
|
||||
{"a.checkpoint":false, "a.run":2, "b.checkpoint":false, "b.run":1, "c.checkpoint":false, "c.run":2}
|
||||
{"a.checkpoint":false, "a.run":1, "b.checkpoint":false, "b.run":3, "c.checkpoint":false, "c.run":1}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
--# run #--
|
||||
--- error ---
|
||||
[0m[31m[0m[31m[0m[31m[0m[31midentifier "b" is undefined in branch 57b4c67d-b128-4b9a-11e39-0e6612f1210e[0m
|
||||
[0m[31m[0m[31m[0m[31m[0m[31midentifier "b" is undefined in branch cf017f8a-7c86-4871-109af-6658231331e6[0m
|
||||
↳ from [4mtest/tests/function scope wrong.ans:4:7[0m in identifier: [2mb[0m[0m
|
||||
↳ from [4mtest/tests/function scope wrong.ans:4:1[0m in text interpolation: [2m| a: {b} |[0m[0m
|
||||
↳ from [4mtest/tests/function scope wrong.ans:4:1[0m in translatable: [2m| a: {b} |[0m[0m
|
||||
|
|
|
|||
|
|
@ -34,8 +34,8 @@
|
|||
| {}"" {}"\"d\":[]" {}"" |
|
||||
--- text ---
|
||||
| {}"function:" |
|
||||
| {}"" {}"($() 12)" {}"" |
|
||||
| {}"" {}"($(x) x)" {}"" |
|
||||
| {}"" {}"$() 12" {}"" |
|
||||
| {}"" {}"$(x) x" {}"" |
|
||||
--- return ---
|
||||
()
|
||||
--# saved #--
|
||||
|
|
|
|||
|
|
@ -1,25 +1,21 @@
|
|||
--# run #--
|
||||
--- error ---
|
||||
[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31mabort[0m
|
||||
[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31mabort[0m
|
||||
↳ from [4mtest/tests/merge nested mutable error bis.ans:14:7[0m in call: [2merror("abort")[0m[0m
|
||||
↳ from [4mtest/tests/merge nested mutable error bis.ans:3:1[0m in block: [2minsert(a, b)…[0m[0m
|
||||
↳ from [4mtest/tests/merge nested mutable error bis.ans:3:18[0m in call: [2m_[0m[0m
|
||||
↳ from [4mtest/tests/merge nested mutable error bis.ans:3:17[0m in return boundary: [2m_[0m[0m
|
||||
↳ from [4mtest/tests/merge nested mutable error bis.ans:3:17[0m in return boundary: [2m_[0m[0m
|
||||
↳ from [4mscript.ans:29:6[0m in call: [2mfn![0m[0m
|
||||
↳ from [4mscript.ans:27:3[0m in block: [2mresumed from = ()…[0m[0m
|
||||
↳ from [4mscript.ans:27:5[0m in call: [2m_[0m[0m
|
||||
↳ from [4mscript.ans:27:3[0m in call: [2m~_[0m[0m
|
||||
↳ from [4mscript.ans:27:3[0m in partial scope: [2m~_…[0m[0m
|
||||
↳ from [4mscript.ans:23:2[0m in block: [2mfn . "current checkpoint" ~…[0m[0m
|
||||
↳ from [4mscript.ans:27:7[0m in call: [2melse![0m[0m
|
||||
↳ from [4mscript.ans:27:3[0m in partial scope: [2melse!…[0m[0m
|
||||
↳ from [4mscript.ans:23:2[0m in block: [2mif(fn . "current checkpoint")…[0m[0m
|
||||
↳ from [4mscript.ans:23:9[0m in call: [2m_[0m[0m
|
||||
↳ from [4mscript.ans:23:7[0m in return boundary: [2m_[0m[0m
|
||||
↳ from [4mscript.ans:23:7[0m in return boundary: [2m_[0m[0m
|
||||
↳ from [4mscript.ans:37:9[0m in call: [2mvalue(s)![0m[0m
|
||||
↳ from [4mscript.ans:36:1[0m in block: [2mvalue(s)![0m[0m
|
||||
↳ from [4mscript.ans:36:20[0m in call: [2m_[0m[0m
|
||||
↳ from [4mscript.ans:36:1[0m in return boundary: [2m_[0m[0m
|
||||
↳ from [4mscript.ans:36:1[0m in return boundary: [2m_[0m[0m
|
||||
↳ from [4mtest/tests/merge nested mutable error bis.ans:19:2[0m in call: [2mf![0m[0m
|
||||
↳ from [4m?[0m in block: [2m:a = *[1]…[0m
|
||||
--# post run check #--
|
||||
|
|
|
|||
|
|
@ -1,25 +1,21 @@
|
|||
--# run #--
|
||||
--- error ---
|
||||
[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31mabort[0m
|
||||
[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31mabort[0m
|
||||
↳ from [4mtest/tests/merge nested mutable error.ans:14:7[0m in call: [2merror("abort")[0m[0m
|
||||
↳ from [4mtest/tests/merge nested mutable error.ans:3:1[0m in block: [2minsert(a, b)…[0m[0m
|
||||
↳ from [4mtest/tests/merge nested mutable error.ans:3:18[0m in call: [2m_[0m[0m
|
||||
↳ from [4mtest/tests/merge nested mutable error.ans:3:17[0m in return boundary: [2m_[0m[0m
|
||||
↳ from [4mtest/tests/merge nested mutable error.ans:3:17[0m in return boundary: [2m_[0m[0m
|
||||
↳ from [4mscript.ans:29:6[0m in call: [2mfn![0m[0m
|
||||
↳ from [4mscript.ans:27:3[0m in block: [2mresumed from = ()…[0m[0m
|
||||
↳ from [4mscript.ans:27:5[0m in call: [2m_[0m[0m
|
||||
↳ from [4mscript.ans:27:3[0m in call: [2m~_[0m[0m
|
||||
↳ from [4mscript.ans:27:3[0m in partial scope: [2m~_…[0m[0m
|
||||
↳ from [4mscript.ans:23:2[0m in block: [2mfn . "current checkpoint" ~…[0m[0m
|
||||
↳ from [4mscript.ans:27:7[0m in call: [2melse![0m[0m
|
||||
↳ from [4mscript.ans:27:3[0m in partial scope: [2melse!…[0m[0m
|
||||
↳ from [4mscript.ans:23:2[0m in block: [2mif(fn . "current checkpoint")…[0m[0m
|
||||
↳ from [4mscript.ans:23:9[0m in call: [2m_[0m[0m
|
||||
↳ from [4mscript.ans:23:7[0m in return boundary: [2m_[0m[0m
|
||||
↳ from [4mscript.ans:23:7[0m in return boundary: [2m_[0m[0m
|
||||
↳ from [4mscript.ans:37:9[0m in call: [2mvalue(s)![0m[0m
|
||||
↳ from [4mscript.ans:36:1[0m in block: [2mvalue(s)![0m[0m
|
||||
↳ from [4mscript.ans:36:20[0m in call: [2m_[0m[0m
|
||||
↳ from [4mscript.ans:36:1[0m in return boundary: [2m_[0m[0m
|
||||
↳ from [4mscript.ans:36:1[0m in return boundary: [2m_[0m[0m
|
||||
↳ from [4mtest/tests/merge nested mutable error.ans:19:2[0m in call: [2mf![0m[0m
|
||||
↳ from [4m?[0m in block: [2m:a = *[1]…[0m
|
||||
--# post run check #--
|
||||
|
|
|
|||
|
|
@ -14,21 +14,18 @@
|
|||
--- text ---
|
||||
| {}"CHECK 2" |
|
||||
--- error ---
|
||||
[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31mt[0m
|
||||
[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31mt[0m
|
||||
↳ from [4mtest/tests/scope checkpoint mutable bis error.ans:32:7[0m in call: [2merror("t")[0m[0m
|
||||
↳ from [4mtest/tests/scope checkpoint mutable bis error.ans:7:1[0m in block: [2minsert(t, len(l) + 1)…[0m[0m
|
||||
↳ from [4mtest/tests/scope checkpoint mutable bis error.ans:7:8[0m in call: [2m_[0m[0m
|
||||
↳ from [4mtest/tests/scope checkpoint mutable bis error.ans:7:1[0m in return boundary: [2m_[0m[0m
|
||||
↳ from [4mtest/tests/scope checkpoint mutable bis error.ans:7:1[0m in return boundary: [2m_[0m[0m
|
||||
↳ from [4mtest/tests/scope checkpoint mutable bis error.ans:19:4[0m in call: [2mf(t)[0m[0m
|
||||
↳ from [4mtest/tests/scope checkpoint mutable bis error.ans:15:2[0m in block: [2m| REC |…[0m[0m
|
||||
↳ from [4mtest/tests/scope checkpoint mutable bis error.ans:15:10[0m in call: [2m_[0m[0m
|
||||
↳ from [4mtest/tests/scope checkpoint mutable bis error.ans:15:8[0m in call: [2mn < 1 ~ _[0m[0m
|
||||
↳ from [4mtest/tests/scope checkpoint mutable bis error.ans:15:2[0m in partial scope: [2mn < 1 ~…[0m[0m
|
||||
↳ from [4mtest/tests/scope checkpoint mutable bis error.ans:15:4[0m in call: [2mif(n < 1)[0m[0m
|
||||
↳ from [4mtest/tests/scope checkpoint mutable bis error.ans:15:2[0m in partial scope: [2mif(n < 1)…[0m[0m
|
||||
↳ from [4mtest/tests/scope checkpoint mutable bis error.ans:7:1[0m in block: [2minsert(t, len(l) + 1)…[0m[0m
|
||||
↳ from [4mtest/tests/scope checkpoint mutable bis error.ans:7:8[0m in call: [2m_[0m[0m
|
||||
↳ from [4mtest/tests/scope checkpoint mutable bis error.ans:7:1[0m in return boundary: [2m_[0m[0m
|
||||
↳ from [4mtest/tests/scope checkpoint mutable bis error.ans:7:1[0m in return boundary: [2m_[0m[0m
|
||||
↳ from [4mtest/tests/scope checkpoint mutable bis error.ans:41:2[0m in call: [2mf(l)[0m[0m
|
||||
↳ from [4m?[0m in block: [2m:x = *[99]…[0m
|
||||
--# post run check #--
|
||||
|
|
|
|||
|
|
@ -10,21 +10,18 @@
|
|||
--- text ---
|
||||
| {}"CHECK" |
|
||||
--- error ---
|
||||
[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31mt[0m
|
||||
[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31mt[0m
|
||||
↳ from [4mtest/tests/scope checkpoint mutable error.ans:23:7[0m in call: [2merror("t")[0m[0m
|
||||
↳ from [4mtest/tests/scope checkpoint mutable error.ans:5:1[0m in block: [2minsert(t, len(l) + 1)…[0m[0m
|
||||
↳ from [4mtest/tests/scope checkpoint mutable error.ans:5:8[0m in call: [2m_[0m[0m
|
||||
↳ from [4mtest/tests/scope checkpoint mutable error.ans:5:1[0m in return boundary: [2m_[0m[0m
|
||||
↳ from [4mtest/tests/scope checkpoint mutable error.ans:5:1[0m in return boundary: [2m_[0m[0m
|
||||
↳ from [4mtest/tests/scope checkpoint mutable error.ans:17:4[0m in call: [2mf(t)[0m[0m
|
||||
↳ from [4mtest/tests/scope checkpoint mutable error.ans:13:2[0m in block: [2m| REC |…[0m[0m
|
||||
↳ from [4mtest/tests/scope checkpoint mutable error.ans:13:10[0m in call: [2m_[0m[0m
|
||||
↳ from [4mtest/tests/scope checkpoint mutable error.ans:13:8[0m in call: [2mn < 1 ~ _[0m[0m
|
||||
↳ from [4mtest/tests/scope checkpoint mutable error.ans:13:2[0m in partial scope: [2mn < 1 ~…[0m[0m
|
||||
↳ from [4mtest/tests/scope checkpoint mutable error.ans:13:4[0m in call: [2mif(n < 1)[0m[0m
|
||||
↳ from [4mtest/tests/scope checkpoint mutable error.ans:13:2[0m in partial scope: [2mif(n < 1)…[0m[0m
|
||||
↳ from [4mtest/tests/scope checkpoint mutable error.ans:5:1[0m in block: [2minsert(t, len(l) + 1)…[0m[0m
|
||||
↳ from [4mtest/tests/scope checkpoint mutable error.ans:5:8[0m in call: [2m_[0m[0m
|
||||
↳ from [4mtest/tests/scope checkpoint mutable error.ans:5:1[0m in return boundary: [2m_[0m[0m
|
||||
↳ from [4mtest/tests/scope checkpoint mutable error.ans:5:1[0m in return boundary: [2m_[0m[0m
|
||||
↳ from [4mtest/tests/scope checkpoint mutable error.ans:32:2[0m in call: [2mf(l)[0m[0m
|
||||
↳ from [4m?[0m in block: [2m:l = *[1]…[0m
|
||||
--# post run check #--
|
||||
|
|
|
|||
|
|
@ -14,21 +14,18 @@
|
|||
--- text ---
|
||||
| {}"CHECK 2" |
|
||||
--- error ---
|
||||
[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31mt[0m
|
||||
[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31m[0m[31mt[0m
|
||||
↳ from [4mtest/tests/scope checkpoint mutable ter error.ans:34:7[0m in call: [2merror("t")[0m[0m
|
||||
↳ from [4mtest/tests/scope checkpoint mutable ter error.ans:7:1[0m in block: [2minsert(t, len(l) + 1)…[0m[0m
|
||||
↳ from [4mtest/tests/scope checkpoint mutable ter error.ans:7:8[0m in call: [2m_[0m[0m
|
||||
↳ from [4mtest/tests/scope checkpoint mutable ter error.ans:7:1[0m in return boundary: [2m_[0m[0m
|
||||
↳ from [4mtest/tests/scope checkpoint mutable ter error.ans:7:1[0m in return boundary: [2m_[0m[0m
|
||||
↳ from [4mtest/tests/scope checkpoint mutable ter error.ans:19:4[0m in call: [2mf(t)[0m[0m
|
||||
↳ from [4mtest/tests/scope checkpoint mutable ter error.ans:15:2[0m in block: [2m| REC |…[0m[0m
|
||||
↳ from [4mtest/tests/scope checkpoint mutable ter error.ans:15:10[0m in call: [2m_[0m[0m
|
||||
↳ from [4mtest/tests/scope checkpoint mutable ter error.ans:15:8[0m in call: [2mn < 1 ~ _[0m[0m
|
||||
↳ from [4mtest/tests/scope checkpoint mutable ter error.ans:15:2[0m in partial scope: [2mn < 1 ~…[0m[0m
|
||||
↳ from [4mtest/tests/scope checkpoint mutable ter error.ans:15:4[0m in call: [2mif(n < 1)[0m[0m
|
||||
↳ from [4mtest/tests/scope checkpoint mutable ter error.ans:15:2[0m in partial scope: [2mif(n < 1)…[0m[0m
|
||||
↳ from [4mtest/tests/scope checkpoint mutable ter error.ans:7:1[0m in block: [2minsert(t, len(l) + 1)…[0m[0m
|
||||
↳ from [4mtest/tests/scope checkpoint mutable ter error.ans:7:8[0m in call: [2m_[0m[0m
|
||||
↳ from [4mtest/tests/scope checkpoint mutable ter error.ans:7:1[0m in return boundary: [2m_[0m[0m
|
||||
↳ from [4mtest/tests/scope checkpoint mutable ter error.ans:7:1[0m in return boundary: [2m_[0m[0m
|
||||
↳ from [4mtest/tests/scope checkpoint mutable ter error.ans:43:2[0m in call: [2mf(l)[0m[0m
|
||||
↳ from [4m?[0m in block: [2m:x = *[99]…[0m
|
||||
--# post run check #--
|
||||
|
|
|
|||
|
|
@ -2,6 +2,6 @@
|
|||
--- text ---
|
||||
| {1:1}"lol" |
|
||||
--- return ---
|
||||
@| {}"a " {1:2}"d" {}" " {1:3}"t" {}" b" |
|
||||
| {}"a " {1:2}"d" {}" " {1:3}"t" {}" b" |
|
||||
--# saved #--
|
||||
{}
|
||||
|
|
@ -2,6 +2,6 @@
|
|||
--- text ---
|
||||
| {}"lol" |
|
||||
--- return ---
|
||||
@| {}"a " {}"d" {}" b" |
|
||||
| {}"a " {}"d" {}" b" |
|
||||
--# saved #--
|
||||
{}
|
||||
19
test/results/while break.ans
Normal file
19
test/results/while break.ans
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
--# run #--
|
||||
--- text ---
|
||||
| {}"" {}"0" {}"" |
|
||||
--- text ---
|
||||
| {}"" {}"1" {}"" |
|
||||
--- text ---
|
||||
| {}"" {}"2" {}"" |
|
||||
--- text ---
|
||||
| {}"" {}"3" {}"" |
|
||||
--- text ---
|
||||
| {}"" {}"4" {}"" |
|
||||
--- text ---
|
||||
| {}"" {}"5" {}"" |
|
||||
--- text ---
|
||||
| {}"ok" |
|
||||
--- return ---
|
||||
()
|
||||
--# saved #--
|
||||
{}
|
||||
17
test/results/while continue.ans
Normal file
17
test/results/while continue.ans
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
--# run #--
|
||||
--- text ---
|
||||
| {}"" {}"1" {}"" |
|
||||
--- text ---
|
||||
| {}"" {}"2" {}"" |
|
||||
--- text ---
|
||||
| {}"" {}"4" {}"" |
|
||||
--- text ---
|
||||
| {}"" {}"5" {}"" |
|
||||
--- text ---
|
||||
| {}"" {}"6" {}"" |
|
||||
--- text ---
|
||||
| {}"ok" |
|
||||
--- return ---
|
||||
()
|
||||
--# saved #--
|
||||
{}
|
||||
|
|
@ -36,6 +36,6 @@
|
|||
--- text ---
|
||||
| {}"" {}"5" {}"" |
|
||||
--- return ---
|
||||
@()
|
||||
()
|
||||
--# saved #--
|
||||
{}
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
:$ a - b
|
||||
@"generic minus"
|
||||
return("generic minus")
|
||||
|
||||
:$ a::string - b::string
|
||||
@a + " minus " + b
|
||||
return(a + " minus " + b)
|
||||
|
||||
| {2-5}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
:$ jump button
|
||||
1 # |A
|
||||
| Suprise choice! |> ()
|
||||
@"JOIN"
|
||||
return("JOIN")
|
||||
|
||||
| Press {jump button!} to jump. |>
|
||||
|ok
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
:$ jump button
|
||||
1 # | a
|
||||
|
||||
@"SPLIT"
|
||||
return("SPLIT")
|
||||
|
||||
| Press {jump button!} to jump. |>
|
||||
| ok
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
:$ jump button
|
||||
@1 # | A
|
||||
return(1 # | A)
|
||||
|
||||
:$ move axis
|
||||
1 # | left
|
||||
@" joystick"
|
||||
return(" joystick")
|
||||
|
||||
| Press {jump button!} to jump. |>
|
||||
|ok
|
||||
|
|
|
|||
|
|
@ -1,16 +1,17 @@
|
|||
1 ~ | a |>
|
||||
if(1)
|
||||
| a |>
|
||||
| -> a
|
||||
| b |>
|
||||
| -> b
|
||||
:@choice = 1
|
||||
|
||||
1 ~ | a |>
|
||||
if(1, $| a |> _)
|
||||
| -> a
|
||||
| b |>
|
||||
| -> b
|
||||
choice = 2
|
||||
|
||||
() ~ | a |>
|
||||
if((), $| a |> _)
|
||||
| -> a
|
||||
| b |>
|
||||
| -> b
|
||||
|
|
@ -22,13 +23,13 @@ choice = 1
|
|||
| -> b
|
||||
choice = 2
|
||||
|
||||
12 # () ~ | a |>
|
||||
12 # if((), $| a |> _)
|
||||
| -> a
|
||||
3 # | b |>
|
||||
| -> b
|
||||
choice = 1
|
||||
|
||||
12 # 1 ~ | a |>
|
||||
12 # if(1, $| a |> _)
|
||||
| -> a
|
||||
3 # | b |>
|
||||
| -> b
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
() ~ |ko
|
||||
1 ~ |ok
|
||||
1 ~ |ok bis
|
||||
if((), $|ko)
|
||||
if(1, $|ok)
|
||||
if(1, $|ok bis)
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
:a = 5
|
||||
|
||||
a == 2 ~
|
||||
if(a == 2)
|
||||
|ko
|
||||
~
|
||||
else!
|
||||
|ok
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
:a = 5
|
||||
|
||||
a == 5 ~
|
||||
if(a == 5)
|
||||
|ok
|
||||
~
|
||||
else!
|
||||
|ko
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
:a = 5
|
||||
|
||||
a == 2 ~
|
||||
if(a == 2)
|
||||
|ko
|
||||
~ () ~
|
||||
else if(())
|
||||
|ko
|
||||
~
|
||||
else!
|
||||
|ok
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
:a = 5
|
||||
|
||||
a == 2 ~
|
||||
if(a == 2)
|
||||
|ko
|
||||
~ 1 ~
|
||||
else if(1)
|
||||
|ok
|
||||
~
|
||||
else!
|
||||
|ko
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
:a = 5
|
||||
|
||||
a == 2 ~
|
||||
if(a == 2)
|
||||
|ko
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
:$ f
|
||||
@|b
|
||||
return(|b)
|
||||
|
||||
|a {5 ~ f!} c
|
||||
|a {if(5, f)} c
|
||||
|
||||
|a {() ~ f!} c
|
||||
|a {if((), f)} c
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
:a = 5
|
||||
|
||||
a == 5 ~
|
||||
if(a == 5)
|
||||
|ok
|
||||
|
|
|
|||
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
:$ format(p::is(person))
|
||||
p = p!value
|
||||
@"Name: {p("name")}\nAge: {p("age")}"
|
||||
return("Name: {p("name")}\nAge: {p("age")}")
|
||||
|
||||
:$ Person(name, age)
|
||||
@{"name":name, "age":age}!type(person)
|
||||
return({"name":name, "age":age}!type(person))
|
||||
|
||||
:abject = Person("Darmanin", 38)
|
||||
|
||||
|
|
|
|||
4
test/tests/default attached block.ans
Normal file
4
test/tests/default attached block.ans
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
:fn = "fn"!script
|
||||
|ok
|
||||
|
||||
fn!
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
:a = 5
|
||||
|
||||
:$ f(p)
|
||||
@a
|
||||
return(a)
|
||||
|
||||
:$ f(p) = v
|
||||
|v={v}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
:f = $(x)x*x
|
||||
|
||||
:$g(x)
|
||||
@x*x
|
||||
return(x*x)
|
||||
|
||||
|{f(5)} = {g(5)}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
:$ hey
|
||||
:@$ foo
|
||||
@2
|
||||
@3
|
||||
@5
|
||||
return(2)
|
||||
return(3)
|
||||
return(5)
|
||||
|u
|
||||
|
||||
|{hey!}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
:$ hey
|
||||
@5
|
||||
return(5)
|
||||
|a
|
||||
@2
|
||||
return(2)
|
||||
|
||||
|{hey!}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
:$ hey
|
||||
:@$ foo
|
||||
@2
|
||||
@5
|
||||
return(2)
|
||||
return(5)
|
||||
|
||||
|{hey!}
|
||||
|{hey.foo!}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
:$ hey
|
||||
@5
|
||||
return(5)
|
||||
|
||||
|{hey!}
|
||||
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
|before recursion {c}: {a}
|
||||
|
||||
n < 5 ~
|
||||
if(n < 5)
|
||||
f(c+1)
|
||||
|
||||
|after recursion {c}: {a}
|
||||
|
|
@ -29,7 +29,7 @@ f!
|
|||
|
||||
|before recursion {c}: {a}
|
||||
|
||||
n < 5 ~
|
||||
if(n < 5)
|
||||
g(c+1, a)
|
||||
|
||||
|after recursion {c}: {a}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
|before recursion {c}: {a}
|
||||
|
||||
n < 5 ~
|
||||
if(n < 5)
|
||||
f(c+1)
|
||||
|
||||
|after recursion {c}: {a}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
:$ a(x::number)
|
||||
@x + 2
|
||||
return(x + 2)
|
||||
|
||||
:$ x
|
||||
:$ a(x::string)
|
||||
@x + "heh"
|
||||
return(x + "heh")
|
||||
|
||||
|{a("plop")}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,10 +11,10 @@ fn(5)
|
|||
fn()
|
||||
|
||||
:$ g(n="s", a::number=5)
|
||||
@"gn"
|
||||
return("gn")
|
||||
|
||||
:$ g(n="s", a::string="lol")
|
||||
@"gs"
|
||||
return("gs")
|
||||
|
||||
|{g(n="k", a="l")}
|
||||
|{g(n="k", a=1)}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
:$ a
|
||||
|a
|
||||
@1
|
||||
return(1)
|
||||
|
||||
:$ b
|
||||
|b
|
||||
@()
|
||||
return(())
|
||||
|
||||
|{a! & b!} = a b ()
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
:i = 0
|
||||
|
||||
(i += 1; i <= 10) ~? (| {i}\n)!
|
||||
while($()(i += 1; i <= 10), $| {i}\n |!)
|
||||
|
||||
|{i}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
:$ f(a, b, c)
|
||||
@a + b + c
|
||||
return(a + b + c)
|
||||
|
||||
|{f("a", "b", "c")} = {f(a="a", b="b", c="c")} = {f(c="c", a="a", b="b")}
|
||||
|
|
|
|||
|
|
@ -1,19 +1,19 @@
|
|||
1 ~
|
||||
if(1)
|
||||
|yes
|
||||
() ~
|
||||
if(())
|
||||
|no
|
||||
~
|
||||
else!
|
||||
|nope
|
||||
1 ~
|
||||
if(1)
|
||||
|niet
|
||||
() ~
|
||||
if(())
|
||||
|still no
|
||||
~
|
||||
else!
|
||||
|nein
|
||||
|
||||
() ~
|
||||
if(())
|
||||
|nah
|
||||
~
|
||||
else!
|
||||
|ye
|
||||
~
|
||||
else!
|
||||
|da
|
||||
|
|
|
|||
|
|
@ -1,18 +1,18 @@
|
|||
1 ~
|
||||
if(1)
|
||||
|a
|
||||
|
||||
|b
|
||||
|
||||
1 ~
|
||||
if(1)
|
||||
|c
|
||||
|d
|
||||
|
||||
1 ~
|
||||
if(1)
|
||||
|e
|
||||
|
||||
| f |> ()
|
||||
:@choice = 1
|
||||
|
||||
1 ~
|
||||
if(1)
|
||||
|g
|
||||
| h |> ()
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
:$ f(a, b, c="c")
|
||||
@a + b + c
|
||||
return(a + b + c)
|
||||
|
||||
|{f("a", "b")} = {f("a", "b", "c")} = {f(b="b", a="a")}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
:f = "f"!script($_)
|
||||
:f = "f"!script
|
||||
"a":"a" #
|
||||
|a
|
||||
1 ~ "x":"x" #
|
||||
if(1, $()("x":"x" # _))
|
||||
"b":"b" #
|
||||
#p!checkpoint($_)
|
||||
"c":"c"# |b
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ g!
|
|||
g!from(#p)
|
||||
|
||||
:h = "h"!script($_)
|
||||
1 ~
|
||||
if(1)
|
||||
| a |>
|
||||
|-> a
|
||||
#p!checkpoint
|
||||
|
|
@ -76,7 +76,7 @@ h!from(#p)
|
|||
|-> ab
|
||||
| b |>
|
||||
|-> b
|
||||
1 ~
|
||||
if(1)
|
||||
| c |>
|
||||
|-> c
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
:f = "f"!script($_)
|
||||
1 ~
|
||||
if(1)
|
||||
#p!checkpoint
|
||||
|x
|
||||
~
|
||||
else!
|
||||
|y
|
||||
|
||||
f!
|
||||
|
|
@ -10,10 +10,10 @@ f!
|
|||
f!from(#p)
|
||||
|
||||
:g = "g"!script($_)
|
||||
() ~
|
||||
if(())
|
||||
#p!checkpoint
|
||||
|x
|
||||
~
|
||||
else!
|
||||
|y
|
||||
|
||||
g!
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
:$ fn
|
||||
:i=0
|
||||
@
|
||||
return(_)
|
||||
i=50
|
||||
i
|
||||
|
||||
| {fn!} = 50
|
||||
|
||||
:$ g
|
||||
@
|
||||
@3
|
||||
return(_)
|
||||
return(3)
|
||||
|
||||
| {g!} = 3
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
:$ f
|
||||
| a |>
|
||||
| x
|
||||
@1
|
||||
return(1)
|
||||
| y
|
||||
@2
|
||||
return(2)
|
||||
|
||||
f! == 2 ~
|
||||
if(f! == 2)
|
||||
:@choice = 1
|
||||
| Yes.
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
|CHECK
|
||||
merge branch!
|
||||
|
||||
n < 1 ~
|
||||
if(n < 1)
|
||||
|REC
|
||||
|
||||
n += 1
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
|CHECK
|
||||
merge branch!
|
||||
|
||||
n < 1 ~
|
||||
if(n < 1)
|
||||
|REC
|
||||
|
||||
n += 1
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|CHECK
|
||||
merge branch!
|
||||
|
||||
n < 1 ~
|
||||
if(n < 1)
|
||||
|REC
|
||||
|
||||
n += 1
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
|CHECK
|
||||
merge branch!
|
||||
|
||||
n < 1 ~
|
||||
if(n < 1)
|
||||
|REC
|
||||
|
||||
n += 1
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
|CHECK
|
||||
merge branch!
|
||||
|
||||
n < 1 ~
|
||||
if(n < 1)
|
||||
|REC
|
||||
|
||||
n += 1
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|CHECK
|
||||
merge branch!
|
||||
|
||||
n < 1 ~
|
||||
if(n < 1)
|
||||
|REC
|
||||
|
||||
n += 1
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
1 #
|
||||
|foo
|
||||
1 ~ "b":[1,2] #
|
||||
1 ~ "a":[2,3] # | bar
|
||||
if(1, $()("b":[1,2] # _))
|
||||
if(1, $()("a":[2,3] # | bar))
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
:$ f
|
||||
@"b"
|
||||
return("b")
|
||||
|
||||
|a {5 # |{f!}} c
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
:$ f
|
||||
1 # | lol
|
||||
|
||||
@2 # |d
|
||||
return(2 # |d)
|
||||
|
||||
:a = |a {f!} {3#|t} b
|
||||
|
||||
@a
|
||||
return(a)
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
:$ f
|
||||
|lol
|
||||
|
||||
@|d
|
||||
return(|d)
|
||||
|
||||
:a = |a {f!} b
|
||||
|
||||
@a
|
||||
return(a)
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
1 # | left
|
||||
| Surprise choice! |>
|
||||
| ok2
|
||||
@" joystick"
|
||||
return(" joystick")
|
||||
|
||||
| Press {jump button!} to jump.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
:$ jump button
|
||||
1 # | A
|
||||
|
||||
@
|
||||
return!
|
||||
|
||||
:$ move axis
|
||||
1 # | left
|
||||
|
||||
@" joystick"
|
||||
return(" joystick")
|
||||
|
||||
| Press {jump button!} to jump.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
:$ jump button
|
||||
@1 # | A
|
||||
return(1 # | A)
|
||||
|
||||
:$ move axis
|
||||
2 # | left
|
||||
@" joystick"
|
||||
return(" joystick")
|
||||
|
||||
| Press {jump button!} to jump.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
:$ -f
|
||||
@"generic minus"
|
||||
return("generic minus")
|
||||
|
||||
:$ -f::string
|
||||
@"minus "+f
|
||||
return("minus "+f)
|
||||
|
||||
|{-5}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
: x = "x"!script($_)
|
||||
|a
|
||||
run == 0 ~ |seen only once
|
||||
if(run == 0, $|seen only once)
|
||||
|b
|
||||
|
||||
x!
|
||||
|
|
|
|||
10
test/tests/while break.ans
Normal file
10
test/tests/while break.ans
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
:i = 0
|
||||
while($i <= 10)
|
||||
| {i}
|
||||
|
||||
if(i == 5)
|
||||
break!
|
||||
|
||||
i += 1
|
||||
|
||||
|ok
|
||||
10
test/tests/while continue.ans
Normal file
10
test/tests/while continue.ans
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
:i = 0
|
||||
while($i <= 5)
|
||||
i += 1
|
||||
|
||||
if(i == 3)
|
||||
continue!
|
||||
|
||||
| {i}
|
||||
|
||||
|ok
|
||||
|
|
@ -2,18 +2,18 @@
|
|||
|
||||
| Start with i={i}:
|
||||
|
||||
i < 5 ~?
|
||||
while($i < 5)
|
||||
| {i}
|
||||
|
||||
i += 1
|
||||
~
|
||||
else!
|
||||
| Loop not ran.
|
||||
|
||||
| Start with i={i}:
|
||||
|
||||
i < 5 ~?
|
||||
while($i < 5)
|
||||
| {i}
|
||||
|
||||
i += 1
|
||||
~
|
||||
else!
|
||||
| Loop not ran.
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
:i = 0
|
||||
i <= 10 ~?
|
||||
while($i <= 10)
|
||||
| {i}
|
||||
|
||||
i += 1
|
||||
|
|
@ -7,10 +7,10 @@ i <= 10 ~?
|
|||
| return in loop:
|
||||
|
||||
i = 0
|
||||
i <= 10 ~?
|
||||
while($i <= 10)
|
||||
| {i}
|
||||
|
||||
i == 5 ~
|
||||
@()
|
||||
if(i == 5)
|
||||
return!
|
||||
|
||||
i += 1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue