summaryrefslogtreecommitdiff
path: root/lib/lua-repl/t/abstract-repl-tests.lua
blob: 50d4b07cff57fdadac0fbebaba0203a4b953bd9e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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 -- }}}