2013-06-17 06:26:43 +00:00
|
|
|
# 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
|
|
|
|
|
2012-12-19 14:56:19 +00:00
|
|
|
# Test events.
|
|
|
|
|
2013-06-17 06:26:43 +00:00
|
|
|
|
2012-12-19 14:56:19 +00:00
|
|
|
# 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
|
2012-12-22 17:38:28 +00:00
|
|
|
|
|
|
|
# test empty argument
|
2013-06-17 06:26:43 +00:00
|
|
|
emit
|