summaryrefslogtreecommitdiff
path: root/lib/lua-repl/t/abstract-repl-tests.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lib/lua-repl/t/abstract-repl-tests.lua')
-rw-r--r--lib/lua-repl/t/abstract-repl-tests.lua33
1 files changed, 33 insertions, 0 deletions
diff --git a/lib/lua-repl/t/abstract-repl-tests.lua b/lib/lua-repl/t/abstract-repl-tests.lua
new file mode 100644
index 00000000..50d4b07c
--- /dev/null
+++ b/lib/lua-repl/t/abstract-repl-tests.lua
@@ -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 -- }}}