7307c869bf70c538fed3d714b3cf55cb3b3eec40
[platform/upstream/bash.git] / tests / type.tests
1 set +o posix
2
3 hash -r
4 unalias -a
5
6 # this should echo nothing
7 type
8 # this should be a usage error
9 type -r ${THIS_SH}
10
11 # these should behave identically
12 type notthere
13 command -v notthere
14
15 alias m=more
16
17 unset -f func 2>/dev/null
18 func() { echo this is func; }
19
20 type -t func
21 type -t while
22 type -t builtin
23 type -t /bin/sh
24 type -t ${THIS_SH}
25 type -t mv
26
27 type func
28 # the following two should produce identical output
29 type while
30 type -a while
31 type builtin
32 type /bin/sh
33
34 command -v func
35 command -V func
36 command -v while
37 command -V while
38
39 # the following three lines should produce the same output
40 # first test with alias expansion off (should all fail or produce no output)
41 type -t m
42 type m
43 command -v m
44 alias -p
45 alias m
46
47 # then test with alias expansion on 
48 shopt -s expand_aliases
49 type m
50 type -t m
51 command -v m
52 alias -p
53 alias m
54
55 command -V m
56 shopt -u expand_aliases
57
58 command -v builtin
59 command -V builtin
60 command -v /bin/sh
61 command -V /bin/sh
62
63 unset -f func
64 type func
65 unalias m
66 type m
67
68 hash -r
69
70 hash -p /bin/sh sh
71 type -p sh
72
73 SHBASE=${THIS_SH##*/}
74 hash -p /tmp/$SHBASE $SHBASE
75 type -p $SHBASE
76 type $SHBASE
77
78 type -t $SHBASE
79
80 # make sure the hash table looks right
81 hash