fork/fish-shell

git clone https://git.julia.blue/fork/fish-shell

Fabian BoehmFix error squiggles when they run into a newlinefb161e9f4

master
1.7 KiB84 linesraw
1# RUN: %fish %s
2# Regression test for issue #4443
3eval set -l previously_undefined foo
4echo $previously_undefined
5# CHECK: foo
6
7# Test redirection
8eval "echo you can\\'t see this 1>&2" 2>/dev/null
9
10# Test return statuses
11false
12eval true
13echo $status
14# CHECK: 0
15false
16eval false
17echo $status
18# CHECK: 1
19
20# Test return status in case of parsing error
21false
22eval "("
23echo $status
24# CHECK: 123
25# CHECKERR: {{.*}}checks/eval.fish (line {{\d+}}): Unexpected end of string, expecting ')'
26# CHECKERR: (
27# CHECKERR: ^
28false
29eval '""'
30echo $status
31# CHECK: 123
32# CHECKERR: {{.*}}checks/eval.fish (line {{\d+}}): The expanded command was empty.
33# CHECKERR: ""
34# CHECKERR: ^^
35
36function empty
37end
38
39# Regression tests for issue #5692
40false
41eval
42echo blank eval: $status # 0
43# CHECK: blank eval: 0
44
45false
46eval ""
47echo empty arg eval: $status # 0
48# CHECK: empty arg eval: 0
49
50false
51eval empty
52echo empty function eval $status # 0
53# CHECK: empty function eval 0
54
55false
56eval "begin; end;"
57echo empty block eval: $status # 0
58# CHECK: empty block eval: 0
59
60source /banana/\t/foo
61# CHECKERR: source: Error encountered while sourcing file '/banana/\t/foo':
62# CHECKERR: source: No such file or directory
63
64# See that eval can't be defined as a function
65function eval
66    builtin eval $argv
67end
68# CHECKERR: {{.*}}checks/eval.fish (line {{\d+}}): function: eval: cannot use reserved keyword as function name
69# CHECKERR: function eval
70# CHECKERR: ^~~~~~~~~~~~^
71
72
73function evil --no-scope-shadowing
74    eval $argv
75end
76
77# And this is why we do this: `eval` *can't* be cleanly shadowed with a function,
78# because that would always introduce a new block or at the very least clobber $argv.
79eval set -l argv this works
80echo $argv
81# CHECK: this works
82evil set -l argv this does not
83echo $argv
84# CHECK: this works