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

88 lines, 37 significant
1# TODO-deprecate: Code we want to get rid of!
2
3
4#### oil:upgrade as alias for ysh:upgrade
5
6shopt -p | grep simple_word
7shopt --set oil:upgrade
8shopt -p | grep simple_word
9
10shopt --unset ysh:upgrade
11shopt -p | grep simple_word
12
13## STDOUT:
14shopt -u simple_word_eval
15shopt -s simple_word_eval
16shopt -u simple_word_eval
17## END
18
19
20#### %() array literal
21
22shopt --set parse_at
23
24var x = %(one two)
25echo @x
26
27## STDOUT:
28one two
29## END
30
31#### _match() instead of _group()
32
33shopt --set ysh:upgrade
34
35if ('foo42' ~ / <capture d+> /) {
36 echo $[_match(0)]
37 echo $[_group(0)]
38}
39
40## STDOUT:
4142
4242
43## END
44
45#### _status instead of _error.code
46
47shopt --set ysh:upgrade
48
49f() {
50 return 42
51}
52
53try {
54 f
55}
56echo status=$_status
57
58## STDOUT:
59status=42
60## END
61
62
63#### source ///osh/two.sh rather than source --builtin osh/two.sh
64
65source --builtin osh/two.sh
66echo status=$?
67
68## STDOUT:
69status=0
70## END
71
72#### OILS_VERSION, not OIL_VERSION
73
74if test -n "$OIL_VERSION"; then
75 echo OIL
76fi
77
78## STDOUT:
79OIL
80## END
81
82#### s.upper(), not s => upper() (might keep this)
83
84echo $['foo' => upper()]
85
86## STDOUT:
87FOO
88## END