neovim

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

vim_syntax_spec.lua (1296B)


      1 local n = require('test.functional.testnvim')()
      2 local Screen = require('test.functional.ui.screen')
      3 
      4 local clear = n.clear
      5 local exec = n.exec
      6 local api = n.api
      7 
      8 describe('Vimscript syntax highlighting', function()
      9  local screen --- @type test.functional.ui.screen
     10 
     11  before_each(function()
     12    clear()
     13    n.add_builddir_to_rtp()
     14    exec([[
     15      setfiletype vim
     16      syntax on
     17    ]])
     18    screen = Screen.new()
     19    screen:set_default_attr_ids({
     20      [0] = { foreground = Screen.colors.Blue, bold = true },
     21      [1] = { foreground = Screen.colors.Brown, bold = true },
     22      [2] = { foreground = tonumber('0x6a0dad') },
     23    })
     24  end)
     25 
     26  it('prefixed boolean options are highlighted properly', function()
     27    api.nvim_buf_set_lines(0, 0, -1, true, {
     28      'set number incsearch hlsearch',
     29      'set nonumber noincsearch nohlsearch',
     30      'set invnumber invincsearch invhlsearch',
     31    })
     32    screen:expect([[
     33      {1:^set} {2:number} {2:incsearch} {2:hlsearch}                        |
     34      {1:set} {2:nonumber} {2:noincsearch} {2:nohlsearch}                  |
     35      {1:set} {2:invnumber} {2:invincsearch} {2:invhlsearch}               |
     36      {0:~                                                    }|*10
     37                                                           |
     38    ]])
     39  end)
     40 end)