neovim

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

lang_spec.lua (1567B)


      1 local t = require('test.testutil')
      2 local n = require('test.functional.testnvim')()
      3 
      4 local clear, insert, eq = n.clear, n.insert, t.eq
      5 local command, expect = n.command, n.expect
      6 local feed, eval = n.feed, n.eval
      7 local exc_exec = n.exc_exec
      8 
      9 describe('gu and gU', function()
     10  before_each(clear)
     11 
     12  it('works in any locale with default casemap', function()
     13    eq('internal,keepascii', eval('&casemap'))
     14    insert('iI')
     15    feed('VgU')
     16    expect('II')
     17    feed('Vgu')
     18    expect('ii')
     19  end)
     20 
     21  describe('works in Turkish locale', function()
     22    clear()
     23 
     24    local err = exc_exec('lang ctype tr_TR.UTF-8')
     25    if err ~= 0 then
     26      pending('Locale tr_TR.UTF-8 not supported', function() end)
     27      return
     28    end
     29 
     30    before_each(function()
     31      command('lang ctype tr_TR.UTF-8')
     32    end)
     33 
     34    it('with default casemap', function()
     35      eq('internal,keepascii', eval('&casemap'))
     36      -- expect ASCII behavior
     37      insert('iI')
     38      feed('VgU')
     39      expect('II')
     40      feed('Vgu')
     41      expect('ii')
     42    end)
     43 
     44    it('with casemap=""', function()
     45      command('set casemap=')
     46      -- expect either Turkish locale behavior or ASCII behavior
     47      local iupper = eval("toupper('i')")
     48      if iupper == 'İ' then
     49        insert('iI')
     50        feed('VgU')
     51        expect('İI')
     52        feed('Vgu')
     53        expect('iı')
     54      elseif iupper == 'I' then
     55        insert('iI')
     56        feed('VgU')
     57        expect('II')
     58        feed('Vgu')
     59        expect('ii')
     60      else
     61        error("expected toupper('i') to be either 'I' or 'İ'")
     62      end
     63    end)
     64  end)
     65 end)