glob_spec.lua (857B)
1 local t = require('test.testutil') 2 local n = require('test.functional.testnvim')() 3 4 local clear, command, eval, eq = n.clear, n.command, n.eval, t.eq 5 local mkdir = t.mkdir 6 7 before_each(function() 8 clear() 9 mkdir('test-glob') 10 11 -- Long path might cause "Press ENTER" prompt; use :silent to avoid it. 12 command('silent cd test-glob') 13 end) 14 15 after_each(function() 16 vim.uv.fs_rmdir('test-glob') 17 end) 18 19 describe('glob()', function() 20 it("glob('.*') returns . and .. ", function() 21 eq({ '.', '..' }, eval("glob('.*', 0, 1)")) 22 -- Do it again to verify scandir_next_with_dots() internal state. 23 eq({ '.', '..' }, eval("glob('.*', 0, 1)")) 24 end) 25 it("glob('*') returns an empty list ", function() 26 eq({}, eval("glob('*', 0, 1)")) 27 -- Do it again to verify scandir_next_with_dots() internal state. 28 eq({}, eval("glob('*', 0, 1)")) 29 end) 30 end)