mirror of
https://github.com/Reuh/anselme.git
synced 2025-10-27 16:49:31 +00:00
Proper checkpointing of mutable values
This commit is contained in:
parent
801df67461
commit
04c6683de8
14 changed files with 243 additions and 23 deletions
|
|
@ -44,7 +44,7 @@ local function write_result(filebase, result)
|
|||
o:write(ser(result))
|
||||
o:write("\n--[[\n")
|
||||
for _, v in ipairs(result) do
|
||||
o:write(inspect(v).."\n")
|
||||
o:write(inspect(v):gsub("]]", "] ]").."\n") -- professional-level bandaid when ]] appear in the output
|
||||
end
|
||||
o:write("]]--")
|
||||
o:close()
|
||||
|
|
|
|||
17
test/tests/merge nested mutable bis.ans
Normal file
17
test/tests/merge nested mutable bis.ans
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
:post run = "check"
|
||||
|
||||
:a = [1]
|
||||
:b = [2]
|
||||
|
||||
~ a!insert(b)
|
||||
|
||||
§ c
|
||||
|
||||
~ b!insert(3)
|
||||
|
||||
§ d
|
||||
|
||||
~ b!insert(4)
|
||||
|
||||
$ check
|
||||
\[1,\[2,3,4]]: {a}
|
||||
21
test/tests/merge nested mutable bis.lua
Normal file
21
test/tests/merge nested mutable bis.lua
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
local _={}
|
||||
_[8]={}
|
||||
_[7]={}
|
||||
_[6]={text="[1, [2, 3, 4]]",tags=_[8]}
|
||||
_[5]={text="[1,[2,3,4]]: ",tags=_[7]}
|
||||
_[4]={_[5],_[6]}
|
||||
_[3]={"return"}
|
||||
_[2]={"text",_[4]}
|
||||
_[1]={"return"}
|
||||
return {_[1],_[2],_[3]}
|
||||
--[[
|
||||
{ "return" }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "[1,[2,3,4] ]: "
|
||||
}, {
|
||||
tags = {},
|
||||
text = "[1, [2, 3, 4] ]"
|
||||
} } }
|
||||
{ "return" }
|
||||
]]--
|
||||
19
test/tests/merge nested mutable error bis.ans
Normal file
19
test/tests/merge nested mutable error bis.ans
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
:post run = "check"
|
||||
|
||||
:a = [1]
|
||||
:b = [2]
|
||||
|
||||
~ a!insert(b)
|
||||
|
||||
§ c
|
||||
|
||||
~ b!insert(3)
|
||||
|
||||
§ d
|
||||
|
||||
~ b!insert(4)
|
||||
|
||||
~ error("abort")
|
||||
|
||||
$ check
|
||||
\[1,\[2,3]]: {a}
|
||||
21
test/tests/merge nested mutable error bis.lua
Normal file
21
test/tests/merge nested mutable error bis.lua
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
local _={}
|
||||
_[8]={}
|
||||
_[7]={}
|
||||
_[6]={text="[1, [2, 3]]",tags=_[8]}
|
||||
_[5]={text="[1,[2,3]]: ",tags=_[7]}
|
||||
_[4]={_[5],_[6]}
|
||||
_[3]={"return"}
|
||||
_[2]={"text",_[4]}
|
||||
_[1]={"error","abort; in Lua function \"error\"; at test/tests/merge nested mutable error bis.ans:16"}
|
||||
return {_[1],_[2],_[3]}
|
||||
--[[
|
||||
{ "error", 'abort; in Lua function "error"; at test/tests/merge nested mutable error bis.ans:16' }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "[1,[2,3] ]: "
|
||||
}, {
|
||||
tags = {},
|
||||
text = "[1, [2, 3] ]"
|
||||
} } }
|
||||
{ "return" }
|
||||
]]--
|
||||
19
test/tests/merge nested mutable error.ans
Normal file
19
test/tests/merge nested mutable error.ans
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
:post run = "check"
|
||||
|
||||
:a = [1]
|
||||
:b = [2]
|
||||
|
||||
~ a!insert(b)
|
||||
|
||||
§ c
|
||||
|
||||
~ b!insert(3)
|
||||
|
||||
§ d
|
||||
|
||||
~ a!insert(4)
|
||||
|
||||
~ error("abort")
|
||||
|
||||
$ check
|
||||
\[1,\[2,3]]: {a}
|
||||
21
test/tests/merge nested mutable error.lua
Normal file
21
test/tests/merge nested mutable error.lua
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
local _={}
|
||||
_[8]={}
|
||||
_[7]={}
|
||||
_[6]={text="[1, [2, 3]]",tags=_[8]}
|
||||
_[5]={text="[1,[2,3]]: ",tags=_[7]}
|
||||
_[4]={_[5],_[6]}
|
||||
_[3]={"return"}
|
||||
_[2]={"text",_[4]}
|
||||
_[1]={"error","abort; in Lua function \"error\"; at test/tests/merge nested mutable error.ans:16"}
|
||||
return {_[1],_[2],_[3]}
|
||||
--[[
|
||||
{ "error", 'abort; in Lua function "error"; at test/tests/merge nested mutable error.ans:16' }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "[1,[2,3] ]: "
|
||||
}, {
|
||||
tags = {},
|
||||
text = "[1, [2, 3] ]"
|
||||
} } }
|
||||
{ "return" }
|
||||
]]--
|
||||
17
test/tests/merge nested mutable.ans
Normal file
17
test/tests/merge nested mutable.ans
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
:post run = "check"
|
||||
|
||||
:a = [1]
|
||||
:b = [2]
|
||||
|
||||
~ a!insert(b)
|
||||
|
||||
§ c
|
||||
|
||||
~ b!insert(3)
|
||||
|
||||
§ d
|
||||
|
||||
~ a!insert(4)
|
||||
|
||||
$ check
|
||||
\[1,\[2,3],4]: {a}
|
||||
21
test/tests/merge nested mutable.lua
Normal file
21
test/tests/merge nested mutable.lua
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
local _={}
|
||||
_[8]={}
|
||||
_[7]={}
|
||||
_[6]={text="[1, [2, 3], 4]",tags=_[8]}
|
||||
_[5]={text="[1,[2,3],4]: ",tags=_[7]}
|
||||
_[4]={_[5],_[6]}
|
||||
_[3]={"return"}
|
||||
_[2]={"text",_[4]}
|
||||
_[1]={"return"}
|
||||
return {_[1],_[2],_[3]}
|
||||
--[[
|
||||
{ "return" }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "[1,[2,3],4]: "
|
||||
}, {
|
||||
tags = {},
|
||||
text = "[1, [2, 3], 4]"
|
||||
} } }
|
||||
{ "return" }
|
||||
]]--
|
||||
Loading…
Add table
Add a link
Reference in a new issue