neovim

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

optionstr_spec.lua (634B)


      1 local t = require('test.unit.testutil')
      2 local itp = t.gen_itp(it)
      3 
      4 local to_cstr = t.to_cstr
      5 local eq = t.eq
      6 
      7 local optionstr = t.cimport('./src/nvim/optionstr.h')
      8 
      9 local check_ff_value = function(ff)
     10  return optionstr.check_ff_value(to_cstr(ff))
     11 end
     12 
     13 describe('check_ff_value', function()
     14  itp('views empty string as invalid', function()
     15    eq(0, check_ff_value(''))
     16  end)
     17 
     18  itp('views "unix", "dos" and "mac" as valid', function()
     19    eq(1, check_ff_value('unix'))
     20    eq(1, check_ff_value('dos'))
     21    eq(1, check_ff_value('mac'))
     22  end)
     23 
     24  itp('views "foo" as invalid', function()
     25    eq(0, check_ff_value('foo'))
     26  end)
     27 end)