diff options
author | John Szakmeister <john@szakmeister.net> | 2015-02-09 06:49:11 -0500 |
---|---|---|
committer | John Szakmeister <john@szakmeister.net> | 2015-02-09 06:49:11 -0500 |
commit | 41d8c8980b088e509c577a35c765d498d5498581 (patch) | |
tree | dc3d8d9b626032cfe7e939e0610d538e467c8ca7 | |
parent | 7ab0fcdd945eaa157004ccee2949c680deff439e (diff) | |
download | rneovim-41d8c8980b088e509c577a35c765d498d5498581.tar.gz rneovim-41d8c8980b088e509c577a35c765d498d5498581.tar.bz2 rneovim-41d8c8980b088e509c577a35c765d498d5498581.zip |
Fix an fs_spec test under FreeBSD and a symlinked home directory.
It turns out the FreeBSD 10 VM has a symlink for the home directory to
/usr/home. Unfortunately, this breaks the test as arg[0] may not have
the symlink resolved, but the path returned from the exe() call will.
As a result, the comparison fails, even though the result is correct.
Let's fix this by running the absolute path through exe() too, and then
comparing the results.
-rw-r--r-- | test/unit/os/fs_spec.lua | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/test/unit/os/fs_spec.lua b/test/unit/os/fs_spec.lua index 90f5a0b7de..1c7d3650a5 100644 --- a/test/unit/os/fs_spec.lua +++ b/test/unit/os/fs_spec.lua @@ -170,12 +170,20 @@ describe('fs function', function() it('returns the absolute path when given an executable relative to the current dir', function() local old_dir = lfs.currentdir() + lfs.chdir(directory) local relative_executable = './' .. executable_name + -- Don't test yet; we need to chdir back first. local res = exe(relative_executable) + lfs.chdir(old_dir) - eq(absolute_executable, res) + + -- 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) |