Improve error reporting for unclosed blocks

This commit is contained in:
ridiculousfish
2014-10-14 00:37:01 -07:00
parent 5db9548f40
commit 1927ebbc5d
4 changed files with 119 additions and 8 deletions

View File

@@ -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

View File

@@ -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