1 | ## our_shell: ysh
|
2 | ## oils_failures_allowed: 1
|
3 |
|
4 | #### global frame doesn't contain builtins like len(), dict(), io
|
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 | #### global frame doesn't contain env vars
|
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 | #### __builtins__ module
|
42 |
|
43 | var b = len(propView(__builtins__))
|
44 |
|
45 | # more than 30 builtins
|
46 | assert [b > 30]
|
47 |
|
48 | var mylist = :| a b |
|
49 |
|
50 | setvar len = 4 # overwrite
|
51 | setvar len = __builtins__.len(mylist)
|
52 | assert [2 === len]
|
53 |
|
54 | ## STDOUT:
|
55 | ## END
|
56 |
|