tests: Fix test setup/teardown in path_spec.lua #2402

A call to lfs.mkdir instead of lfs.rmdir left a temp directory hanging
around. Changed to do proper setup/teardown using {before,after}_each.

Helped-by: Scott Prager <splinterofchaos@gmail.com>
Suggested-by: Scott Prager <splinterofchaos@gmail.com>
This commit is contained in:
David Bürgin 2015-04-10 22:23:01 +02:00 committed by Justin M. Keyes
parent fb6e931268
commit e129e2792d

View File

@ -425,19 +425,18 @@ describe('more path function', function()
return ffi.string(c_file) return ffi.string(c_file)
end end
before_each(function() lfs.mkdir('CamelCase') end)
after_each(function() lfs.rmdir('CamelCase') end)
if ffi.os == 'Windows' or ffi.os == 'OSX' then if ffi.os == 'Windows' or ffi.os == 'OSX' then
it('Corrects the case of file names in Mac and Windows', function() it('Corrects the case of file names in Mac and Windows', function()
lfs.mkdir('CamelCase')
eq('CamelCase', fix_case('camelcase')) eq('CamelCase', fix_case('camelcase'))
eq('CamelCase', fix_case('cAMELcASE')) eq('CamelCase', fix_case('cAMELcASE'))
lfs.rmdir('CamelCase')
end) end)
else else
it('does nothing on Linux', function() it('does nothing on Linux', function()
lfs.mkdir('CamelCase')
eq('camelcase', fix_case('camelcase')) eq('camelcase', fix_case('camelcase'))
eq('cAMELcASE', fix_case('cAMELcASE')) eq('cAMELcASE', fix_case('cAMELcASE'))
lfs.mkdir('CamelCase')
end) end)
end end
end) end)