Skip to content

Commit

Permalink
tests: Start adding :function tests for function definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
ZyX-I committed Apr 2, 2015
1 parent 946f515 commit c57f80b
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions test/unit/viml/executor/blocks_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -198,3 +198,32 @@ describe(':try block', function()
echo v:exception
]], {'', '', 'E121: Undefined variable: a', '', ''})
end)

describe(':function definition', function()
local ito, itoe
do
local _obj_0 = require('test.unit.viml.executor.helpers')(it)
ito = _obj_0.ito
itoe = _obj_0.itoe
end
ito('Calls user-defined function with default return value', [[
function Abc()
echo 'Abc'
endfunction
echo Abc()
delfunction Abc
]], {'Abc', 0})
ito('Does not add `self` for regular call', [[
function Abc()
echo self
endfunction
try
echo Abc()
catch
echo v:exception
endtry
delfunction Abc
]], {
'E121: Undefined variable: self'
})
end)

0 comments on commit c57f80b

Please sign in to comment.