glob2regpat_spec.lua 620 B

12345678910111213141516171819202122
  1. -- Tests for signs
  2. local helpers = require('test.functional.helpers')(after_each)
  3. local clear, exc_exec = helpers.clear, helpers.exc_exec
  4. local eq, eval = helpers.eq, helpers.eval
  5. describe('glob2regpat()', function()
  6. before_each(clear)
  7. it('handles invalid input', function()
  8. eq('Vim(call):E806: using Float as a String',
  9. exc_exec('call glob2regpat(1.33)'))
  10. end)
  11. it('returns ^$ for empty input', function()
  12. eq('^$', eval("glob2regpat('')"))
  13. end)
  14. it('handles valid input', function()
  15. eq('^foo\\.', eval("glob2regpat('foo.*')"))
  16. eq('\\.vim$', eval("glob2regpat('*.vim')"))
  17. end)
  18. end)