1 |
## our_shell: ysh
|
2 |
## oils_failures_allowed: 2
|
3 |
|
4 |
|
5 |
|
6 |
try {
|
7 |
pp frame_vars_ | grep -o len
|
8 |
}
|
9 |
pp test_ (_pipeline_status)
|
10 |
|
11 |
try {
|
12 |
pp frame_vars_ | grep -o dict
|
13 |
}
|
14 |
pp test_ (_pipeline_status)
|
15 |
|
16 |
try {
|
17 |
pp frame_vars_ | grep -o -w io
|
18 |
}
|
19 |
pp test_ (_pipeline_status)
|
20 |
|
21 |
## STDOUT:
|
22 |
(List) [0,1]
|
23 |
(List) [0,1]
|
24 |
(List) [0,1]
|
25 |
## END
|
26 |
|
27 |
|
28 |
|
29 |
#pp frame_vars_
|
30 |
|
31 |
try {
|
32 |
pp frame_vars_ | grep -o TMP
|
33 |
}
|
34 |
pp test_ (_pipeline_status)
|
35 |
|
36 |
|
37 |
## STDOUT:
|
38 |
(List) [0,1]
|
39 |
## END
|
40 |
|
41 |
|
42 |
|
43 |
echo "IFS=[$IFS]"
|
44 |
echo "PWD=[$PWD]"
|
45 |
|
46 |
## STDOUT:
|
47 |
## END
|
48 |
|
49 |
|
50 |
|
51 |
pp test_ (type(__defaults__))
|
52 |
|
53 |
pp test_ (__defaults__)
|
54 |
|
55 |
## STDOUT:
|
56 |
(Str) "Dict"
|
57 |
## END
|
58 |
|
59 |
|
60 |
|
61 |
|
62 |
var b = len(propView(__builtins__))
|
63 |
|
64 |
# more than 30 builtins
|
65 |
assert [b > 30]
|
66 |
|
67 |
var mylist = :| a b |
|
68 |
|
69 |
setvar len = 4 # overwrite
|
70 |
setvar len = __builtins__.len(mylist)
|
71 |
assert [2 === len]
|
72 |
|
73 |
## STDOUT:
|
74 |
## END
|
75 |
|
76 |
|
77 |
|
78 |
|
79 |
try { cd }
|
80 |
echo code=$[_error.code]
|
81 |
echo
|
82 |
|
83 |
setglobal ENV.HOME = '/tmp'
|
84 |
|
85 |
# Now it's respected
|
86 |
try { cd }
|
87 |
echo code=$[_error.code]
|
88 |
|
89 |
pwd
|
90 |
|
91 |
## STDOUT:
|
92 |
code=1
|
93 |
|
94 |
code=0
|
95 |
/tmp
|
96 |
## END
|
97 |
|
98 |
|
99 |
|
100 |
setglobal ENV.PATH = '/bin'
|
101 |
|
102 |
# ls is required by POSIX
|
103 |
compgen -c | grep -w 'ls'
|
104 |
|
105 |
## STDOUT:
|
106 |
ls
|
107 |
## END
|