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

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