neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

056_script_local_function_spec.lua (760B)


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