Define a common mktemp for tests

GNU and BSD `mktemp` handle options differently, and it's a useful
utility for tests. As such, define a common `mktemp` function wrapper
for the test suite.

It might actually be nice to expand this for more flags and support it
globally, but that may result in confusion for any users of BSD mktemp
that expect to be running /bin/mktemp.
This commit is contained in:
Kevin Ballard
2014-10-27 20:48:39 -07:00
parent e13d423b68
commit 83df5ea660
3 changed files with 113 additions and 8 deletions

View File

@@ -82,11 +82,10 @@ echo ()[1]
echo ()[d]
# Test tilde expansion
# On OS X, we must pass an argument to mktemp,
# and /tmp is symlinked to /private/tmp
# On OS X, /tmp is symlinked to /private/tmp
# $PWD is our best bet for resolving it
set -l saved $PWD
cd (mktemp -d /tmp/fish_tilde_XXXXXX)
cd (mktemp -d)
set tmpdir $PWD
cd $saved
mkdir $tmpdir/realhome