add a cool lua repl

This commit is contained in:
jacqueline
2023-12-13 16:10:08 +11:00
parent 5a2f0b08e0
commit 64b106c13e
87 changed files with 8150 additions and 5 deletions
+33
View File
@@ -0,0 +1,33 @@
-- vim:foldmethod=marker
local repl = require 'repl'
pcall(require, 'luarocks.loader')
require 'Test.More'
plan(8)
do -- getprompt tests {{{
is(repl:getprompt(1), '>')
is(repl:getprompt(2), '>>')
end -- }}}
do -- prompt abstract tests {{{
error_like(function()
repl:prompt(1)
end, 'You must implement the showprompt method')
error_like(function()
repl:prompt(2)
end, 'You must implement the showprompt method')
end -- }}}
do -- name tests {{{
is(repl:name(), 'REPL')
end -- }}}
do -- handleline abstract tests {{{
is(_G.testresult, nil)
error_like(function()
repl:handleline '_G.testresult = 17'
end, 'You must implement the displayresults method')
is(_G.testresult, 17)
end -- }}}