mirror of
https://github.com/fish-shell/fish-shell
synced 2024-11-11 23:47:25 +00:00
37 lines
773 B
Text
37 lines
773 B
Text
# ensure that builtins that produce no output can still truncate files
|
|
# (bug PCA almost reintroduced!)
|
|
echo "Testing that builtins can truncate files"
|
|
echo abc > /tmp/file_truncation_test.txt
|
|
cat /tmp/file_truncation_test.txt
|
|
echo -n > /tmp/file_truncation_test.txt
|
|
cat /tmp/file_truncation_test.txt
|
|
|
|
# Test events.
|
|
|
|
|
|
# This pattern caused a crash; github issue #449
|
|
|
|
set -g var before
|
|
|
|
function test1 --on-event test
|
|
set -g var $var:test1
|
|
functions -e test2
|
|
end
|
|
|
|
function test2 --on-event test
|
|
# this should not run, as test2 gets removed before it has a chance of running
|
|
set -g var $var:test2a
|
|
end
|
|
emit test
|
|
|
|
echo $var
|
|
|
|
|
|
function test3 --on-event test3
|
|
echo received event test3 with args: $argv
|
|
end
|
|
|
|
emit test3 foo bar
|
|
|
|
# test empty argument
|
|
emit
|