OILS / spec / ysh-env.test.sh View on Github | oilshell.org

60 lines, 19 significant
1## oils_failures_allowed: 1
2
3#### Can read from ENV Dict
4shopt -s ysh:upgrade
5
6pp test_ (type(ENV))
7#pp test_ (ENV)
8
9# Set by the spec test harness
10
11if (ENV.SH ~~ '*osh') {
12 echo ok
13}
14
15#echo SH=$[ENV.SH]
16
17## STDOUT:
18(Str) "Dict"
19ok
20## END
21
22#### Temp bindings A=a B=b my-command push to ENV dict
23shopt -s ysh:upgrade
24
25_A=a _B=b env | grep '^_' | sort
26
27## STDOUT:
28_A=a
29_B=b
30## END
31
32#### setglobal ENV.PYTHONPATH = 'foo' changes child process state
33shopt -s ysh:upgrade
34
35setglobal ENV.PYTHONPATH = 'foo'
36
37pp test_ (ENV)
38
39#export PYTHONPATH=zz
40
41# execute POSIX shell
42sh -c 'echo pythonpath=$PYTHONPATH'
43
44## STDOUT:
45## END
46
47#### export builtin still works
48shopt -s ysh:upgrade
49
50export PYTHONPATH='foo'
51
52#pp test_ (ENV)
53
54# execute POSIX shell
55sh -c 'echo pythonpath=$PYTHONPATH'
56
57## STDOUT:
58pythonpath=foo
59## END
60