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

100 lines, 50 significant
1## oils_failures_allowed: 1
2## our_shell: ysh
3
4#### help topic not found
5
6help zz
7
8## status: 1
9## STDOUT:
10## END
11
12#### help topics that are embedded
13
14help > help.txt
15echo no args $?
16echo
17
18for topic in help oils-usage {osh,ysh}-usage {osh,ysh}-chapters; do
19 help $topic | fgrep -o "~~~ $topic"
20 echo $topic $?
21 echo
22done
23
24## STDOUT:
25no args 0
26
27~~~ help
28help 0
29
30~~~ oils-usage
31oils-usage 0
32
33~~~ osh-usage
34osh-usage 0
35
36~~~ ysh-usage
37ysh-usage 0
38
39~~~ osh-chapters
40osh-chapters 0
41
42~~~ ysh-chapters
43ysh-chapters 0
44
45## END
46
47#### help topics that print URLs
48
49help command-sub | grep -o chap-word-lang.html
50echo status=$?
51
52help read | grep -o chap-builtin-cmd.html
53echo status=$?
54
55## STDOUT:
56chap-word-lang.html
57status=0
58chap-builtin-cmd.html
59status=0
60## END
61
62#### help shows 'ysh-chapters' topic
63
64# shows ~~~ instead of ANSI text
65help | grep ysh-chapters
66
67echo status=$?
68
69## STDOUT:
70~~~ ysh-chapters ~~~
71status=0
72## END
73
74#### help List/append chr etc.
75
76shopt --set ysh:upgrade
77
78proc assert-lines {
79 var num_lines = $(@ARGV | wc -l)
80 #echo "lines = $num_lines"
81 if (num_lines < 2) {
82 error "only got $num_lines lines"
83 }
84}
85
86assert-lines help List/append
87echo status=$?
88
89assert-lines help cmd/append
90echo status=$?
91
92assert-lines help chr
93echo status=$?
94
95## STDOUT:
96status=0
97status=0
98status=0
99## END
100