056_script_local_function_spec.lua 760 B

123456789101112131415161718192021222324252627282930313233
  1. -- vim: set foldmethod=marker foldmarker=[[,]] :
  2. -- Test for script-local function.
  3. local n = require('test.functional.testnvim')()
  4. local clear, feed, insert = n.clear, n.feed, n.insert
  5. local expect = n.expect
  6. describe('source function', function()
  7. setup(clear)
  8. it('is working', function()
  9. insert([[
  10. fun DoLast()
  11. call append(line('$'), "last line")
  12. endfun
  13. fun DoNothing()
  14. call append(line('$'), "nothing line")
  15. endfun
  16. nnoremap <buffer> _x :call DoNothing()<bar>call DoLast()<cr>]])
  17. feed(':<C-R>=getline(1,3)<cr><cr>')
  18. feed(':<C-R>=getline(4,6)<cr><cr>')
  19. feed(':<C-R>=getline(7)<cr><cr>')
  20. feed('ggdG')
  21. feed('_xggdd')
  22. expect([[
  23. nothing line
  24. last line]])
  25. end)
  26. end)