mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-04 15:51:15 -03:00
Improve error reporting for unclosed blocks
This commit is contained in:
@@ -1 +1,7 @@
|
||||
emit: expected event name
|
||||
Missing end to balance this begin
|
||||
Missing end to balance this while loop
|
||||
Missing end to balance this for loop
|
||||
Missing end to balance this switch statement
|
||||
Missing end to balance this function definition
|
||||
Missing end to balance this if statement
|
||||
|
||||
@@ -97,4 +97,15 @@ else
|
||||
echo 'psub file was deleted'
|
||||
end
|
||||
|
||||
# Test support for unbalanced blocks
|
||||
function try_unbalanced_block
|
||||
../fish -c "echo $argv | source " 2>&1 | grep "Missing end" 1>&2
|
||||
end
|
||||
try_unbalanced_block 'begin'
|
||||
try_unbalanced_block 'while true'
|
||||
try_unbalanced_block 'for x in 1 2 3'
|
||||
try_unbalanced_block 'switch abc'
|
||||
try_unbalanced_block 'function anything'
|
||||
try_unbalanced_block 'if false'
|
||||
|
||||
false
|
||||
|
||||
Reference in New Issue
Block a user