# Block hooks should be called as expected.
_set start_block="start" end_block="end"
command
---
Command { name: "command", args: [], prefix: None, tags: {}, silent: false, fail: false, line_number: 3 }
end
command
---
start
Command { name: "command", args: [], prefix: None, tags: {}, silent: false, fail: false, line_number: 8 }
end
# Newlines in block hooks should be handled appropriately.
_set start_block="start\n" end_block="end\n"
command
---
start
Command { name: "command", args: [], prefix: None, tags: {}, silent: false, fail: false, line_number: 16 }
end
command
---
start
Command { name: "command", args: [], prefix: None, tags: {}, silent: false, fail: false, line_number: 22 }
end
# As should empty lines.
_set start_block="start\n\n" end_block="end\n\n"
command
---
> start
> Command { name: "command", args: [], prefix: None, tags: {}, silent: false, fail: false, line_number: 30 }
> end
>
_set end_block="end"
command
---
> start
>
> Command { name: "command", args: [], prefix: None, tags: {}, silent: false, fail: false, line_number: 38 }
> end
_set start_block="" end_block=""
---
> start
>
# Command hooks should be called before/after each command. It should be affected
# by command prefixes and silencing.
(_set start_command="start" end_command="end")
command
prefix: command
(command)
---
start
Command { name: "command", args: [], prefix: None, tags: {}, silent: false, fail: false, line_number: 53 }
end
prefix: start
prefix: Command { name: "command", args: [], prefix: Some("prefix"), tags: {}, silent: false, fail: false, line_number: 54 }
prefix: end
# They should also be called after commands that were expected to fail.
! _panic foo
---
start
Panic: foo
end
# Newlines should be handled properly.
(_set start_command="start\n" end_command="end\n")
command
---
start
Command { name: "command", args: [], prefix: None, tags: {}, silent: false, fail: false, line_number: 73 }
end
(_set start_command="start\n\n" end_command="end\n\n")
command
---
> start
>
> Command { name: "command", args: [], prefix: None, tags: {}, silent: false, fail: false, line_number: 80 }
> end
>