2014-10-22 13:55:13 -07:00
|
|
|
-- Test if fnameescape is correct for special chars like!
|
|
|
|
|
2016-04-23 16:53:11 -07:00
|
|
|
local helpers = require('test.functional.helpers')(after_each)
|
2015-11-17 14:44:00 -07:00
|
|
|
local clear = helpers.clear
|
2017-04-08 14:12:26 -07:00
|
|
|
local command, expect = helpers.command, helpers.expect
|
2014-10-22 13:55:13 -07:00
|
|
|
|
|
|
|
describe('fnameescape', function()
|
|
|
|
setup(clear)
|
|
|
|
|
|
|
|
it('is working', function()
|
2017-04-08 14:12:26 -07:00
|
|
|
command('let fname = "Xspa ce"')
|
|
|
|
command('try | exe "w! " . fnameescape(fname) | put=\'Space\' | endtry')
|
|
|
|
command('let fname = "Xemark!"')
|
|
|
|
command('try | exe "w! " . fnameescape(fname) | put=\'ExclamationMark\' | endtry')
|
2014-10-22 13:55:13 -07:00
|
|
|
|
|
|
|
expect([[
|
2017-04-08 14:12:26 -07:00
|
|
|
|
2014-10-22 13:55:13 -07:00
|
|
|
Space
|
|
|
|
ExclamationMark]])
|
|
|
|
end)
|
|
|
|
|
|
|
|
teardown(function()
|
|
|
|
os.remove("Xspa ce")
|
|
|
|
os.remove("Xemark!")
|
|
|
|
end)
|
|
|
|
end)
|