diff options
author | Rich Churcher <rich.churcher@gmail.com> | 2015-04-01 09:21:21 +1300 |
---|---|---|
committer | Rich Churcher <rich.churcher@gmail.com> | 2015-04-01 09:21:21 +1300 |
commit | 1200f1f20eea21366352d6e6b6a5d327791be0dc (patch) | |
tree | 4c53bc28470297499f0c176c6d0f3218e15ff5a6 | |
parent | 7080041465af6ca530389e2270025f43c4932a0f (diff) | |
download | rneovim-1200f1f20eea21366352d6e6b6a5d327791be0dc.tar.gz rneovim-1200f1f20eea21366352d6e6b6a5d327791be0dc.tar.bz2 rneovim-1200f1f20eea21366352d6e6b6a5d327791be0dc.zip |
Use lfs.currentdir() to fix symlink test fail.
-rw-r--r-- | test/unit/os/fs_spec.lua | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/test/unit/os/fs_spec.lua b/test/unit/os/fs_spec.lua index 9e5a2349c8..1158b81a1d 100644 --- a/test/unit/os/fs_spec.lua +++ b/test/unit/os/fs_spec.lua @@ -172,17 +172,17 @@ describe('fs function', function() local old_dir = lfs.currentdir() lfs.chdir(directory) - local relative_executable = './' .. executable_name - -- Don't test yet; we need to chdir back first. + -- Rely on currentdir to resolve symlinks, if any. Testing against + -- the absolute path taken from arg[0] may result in failure where + -- the path has a symlink in it. + local canonical = lfs.currentdir() .. '/' .. executable_name + local expected = exe(canonical) + local relative_executable = './' .. executable_name local res = exe(relative_executable) + -- Don't test yet; we need to chdir back first. lfs.chdir(old_dir) - - -- Need to canonicalize the absolute path taken from arg[0], because the - -- path may have a symlink in it. For example, /home is symlinked in - -- FreeBSD 10's VM image. - local expected = exe(absolute_executable) eq(expected, res) end) end) |