diff --git a/tests/checks/basic.fish b/tests/checks/basic.fish index 1cf67c468..e230c8aed 100644 --- a/tests/checks/basic.fish +++ b/tests/checks/basic.fish @@ -3,6 +3,10 @@ # Test function, loops, conditionals and some basic elements # +# The test driver always starts each test in its own temporary directory, but to make it easier to +# run this test directly for whatever reason: +set -g tmpdir (mktemp -d) + # Comments in odd places don't cause problems for i in 1 2 # Comment on same line as command # Comment inside loop @@ -42,12 +46,12 @@ end # Simple function tests function foo - echo >./fish_foo.txt $argv + echo > $tmpdir/fish_foo.txt $argv end foo hello -cat ./fish_foo.txt |read foo +cat $tmpdir/fish_foo.txt |read foo if test $foo = hello; echo Test 2 pass @@ -327,10 +331,10 @@ type -q -f fish_test_type_zzz ; echo $status # ensure that builtins that produce no output can still truncate files # (bug PCA almost reintroduced!) -echo abc > ./file_truncation_test.txt -cat ./file_truncation_test.txt -echo -n > ./file_truncation_test.txt -cat ./file_truncation_test.txt +echo abc > $tmpdir/file_truncation_test.txt +cat $tmpdir/file_truncation_test.txt +echo -n > $tmpdir/file_truncation_test.txt +cat $tmpdir/file_truncation_test.txt #CHECK: abc # Test events.