2015-11-17 23:31:22 +01:00
|
|
|
local lfs = require('lfs')
|
2016-04-24 02:53:11 +03:00
|
|
|
local helpers = require('test.functional.helpers')(after_each)
|
2017-04-09 00:12:26 +03:00
|
|
|
local clear, command, eval, eq = helpers.clear, helpers.command, helpers.eval, helpers.eq
|
2015-07-25 18:08:25 -03:00
|
|
|
|
|
|
|
|
before_each(function()
|
|
|
|
|
clear()
|
|
|
|
|
lfs.mkdir('test-glob')
|
2015-08-21 21:28:15 -04:00
|
|
|
|
|
|
|
|
-- Long path might cause "Press ENTER" prompt; use :silent to avoid it.
|
2017-04-09 00:12:26 +03:00
|
|
|
command('silent cd test-glob')
|
2015-07-25 18:08:25 -03:00
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
after_each(function()
|
|
|
|
|
lfs.rmdir('test-glob')
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
describe('glob()', function()
|
|
|
|
|
it("glob('.*') returns . and .. ", function()
|
|
|
|
|
eq({'.', '..'}, eval("glob('.*', 0, 1)"))
|
2015-08-01 23:33:54 -04:00
|
|
|
-- Do it again to verify scandir_next_with_dots() internal state.
|
|
|
|
|
eq({'.', '..'}, eval("glob('.*', 0, 1)"))
|
2015-07-25 18:08:25 -03:00
|
|
|
end)
|
|
|
|
|
it("glob('*') returns an empty list ", function()
|
|
|
|
|
eq({}, eval("glob('*', 0, 1)"))
|
2015-08-01 23:33:54 -04:00
|
|
|
-- Do it again to verify scandir_next_with_dots() internal state.
|
|
|
|
|
eq({}, eval("glob('*', 0, 1)"))
|
2015-07-25 18:08:25 -03:00
|
|
|
end)
|
|
|
|
|
end)
|