aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/test9.in
blob: a38fbc7c1e25ee96aca6e92ff1ac40cdfe03059c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# 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