about summary refs log tree commit diff
path: root/Test/A02alias.ztst
blob: 36dfa241e509e13267f46828f9fb6c4254b75e8d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# To get the "command not found" message when aliasing is suppressed
# we need, er, a command that isn't found.
# The other aliases are only ever used as aliases.

%prep
  alias ThisCommandDefinitelyDoesNotExist=echo

  alias -g bar=echo

  alias '\bar=echo'

%test
  ThisCommandDefinitelyDoesNotExist ThisCommandDefinitelyDoesNotExist
0:Basic aliasing
>ThisCommandDefinitelyDoesNotExist

  bar bar
0:Global aliasing
>echo

  \ThisCommandDefinitelyDoesNotExist ThisCommandDefinitelyDoesNotExist
127:Not aliasing
?(eval):1: command not found: ThisCommandDefinitelyDoesNotExist

  \bar \bar
0:Aliasing with a backslash
>bar

  (alias '!=echo This command has the argument'
  eval 'print Without
  ! true'
  setopt posixaliases
  eval 'print With
  ! true')
1:POSIX_ALIASES option
>Without
>This command has the argument true
>With

  print -u $ZTST_fd 'This test hangs the shell when it fails...'
  alias cat='LC_ALL=C cat'
  cat <(echo foo | cat)
0:Alias expansion works at the end of parsed strings
>foo

  alias '&&=(){ return $?; } && '
  alias not_the_print_command=print
  eval 'print This is output
  && print And so is this
  && { print And this too; false; }
  && print But not this
  && print Nor this
  true
  && not_the_print_command And aliases are expanded'
0:We can now alias special tokens.  Woo hoo.
>This is output
>And so is this
>And this too
>And aliases are expanded