optionstr_spec.lua 632 B

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