diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2018-01-29 22:56:35 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-29 22:56:35 +0100 |
commit | b55f831678bccc9ca7a2fb9d8123d20985ba3719 (patch) | |
tree | 3e17254f6584d74484cd40bc67372349d7fc7145 /test/functional/eval/fnamemodify_spec.lua | |
parent | 9a36337d32481e0324fe85e2b4886e02f8f74a2c (diff) | |
parent | 41b3c7850f839b46affe35bf2de92bc18113b0f7 (diff) | |
download | rneovim-b55f831678bccc9ca7a2fb9d8123d20985ba3719.tar.gz rneovim-b55f831678bccc9ca7a2fb9d8123d20985ba3719.tar.bz2 rneovim-b55f831678bccc9ca7a2fb9d8123d20985ba3719.zip |
Merge #7842 'win: fnamemodify()'
Diffstat (limited to 'test/functional/eval/fnamemodify_spec.lua')
-rw-r--r-- | test/functional/eval/fnamemodify_spec.lua | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/test/functional/eval/fnamemodify_spec.lua b/test/functional/eval/fnamemodify_spec.lua new file mode 100644 index 0000000000..fe6b50a544 --- /dev/null +++ b/test/functional/eval/fnamemodify_spec.lua @@ -0,0 +1,39 @@ +local helpers = require('test.functional.helpers')(after_each) +local clear = helpers.clear +local eq = helpers.eq +local iswin = helpers.iswin +local fnamemodify = helpers.funcs.fnamemodify +local command = helpers.command +local write_file = helpers.write_file + +describe('fnamemodify()', function() + setup(function() + write_file('Xtest-fnamemodify.txt', [[foobar]]) + end) + + before_each(clear) + + teardown(function() + os.remove('Xtest-fnamemodify.txt') + end) + + it('works', function() + local root = helpers.pathroot() + eq(root, fnamemodify([[/]], ':p:h')) + eq(root, fnamemodify([[/]], ':p')) + if iswin() then + eq(root, fnamemodify([[\]], ':p:h')) + eq(root, fnamemodify([[\]], ':p')) + command('set shellslash') + root = string.sub(root, 1, -2)..'/' + eq(root, fnamemodify([[\]], ':p:h')) + eq(root, fnamemodify([[\]], ':p')) + eq(root, fnamemodify([[/]], ':p:h')) + eq(root, fnamemodify([[/]], ':p')) + end + end) + + it(':8 works', function() + eq('Xtest-fnamemodify.txt', fnamemodify([[Xtest-fnamemodify.txt]], ':8')) + end) +end) |