File: hook_test.elvts

package info (click to toggle)
elvish 0.21.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 6,372 kB
  • sloc: javascript: 236; sh: 130; python: 104; makefile: 88; xml: 9
file content (18 lines) | stat: -rw-r--r-- 497 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//each:call-hook-in-global

~> call-hook test-hook [{ echo hook1 } { echo hook2 }]
hook1
hook2
// Arguments
~> call-hook test-hook [{|x| echo hook$x }] foo
hookfoo
// Invalid hook list
~> call-hook test-hook [not-a-fn]
hook test-hook[0] must be callable
// Exception thrown from hook prints the exception to port 2, rather than being
// propagated
~> call-hook test-hook [{ fail bad }]
   echo after call-hook >&2
Exception: bad
  [tty]:1:24-32: call-hook test-hook [{ fail bad }]
after call-hook