optionstr_spec.lua 673 B

1234567891011121314151617181920212223242526272829
  1. local helpers = require("test.unit.helpers")(after_each)
  2. local itp = helpers.gen_itp(it)
  3. local to_cstr = helpers.to_cstr
  4. local eq = helpers.eq
  5. local option = helpers.cimport("./src/nvim/optionstr.h")
  6. local check_ff_value = function(ff)
  7. return option.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)