-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathhelp_test.go
More file actions
56 lines (49 loc) · 1.71 KB
/
Copy pathhelp_test.go
File metadata and controls
56 lines (49 loc) · 1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package main
import (
"bytes"
"testing"
"text/tabwriter"
)
const helpOutput = ` list : List profiles' information.
choose : Choose <profile> as the current profile.
edit : Edit profiles or scripts with the 'editor'. [profile|install].
config : Handle kernel's configuration. [menu|def|save].
build : Build various targets of kernel. [image|modules|dtb].
install : Execute your own install script.
make : Execute '$ make <target>' on current kernel.
dts : List relevant DTS files.
version : Print version information.
completion : Generate a shell completion file.
help : Print help message for one or all commands. [<cmd>].
`
func Test_helpOutput(t *testing.T) {
var output bytes.Buffer
w := tabwriter.NewWriter(&output, 0, 0, 1, ' ', tabwriter.TabIndent)
for _, h := range helpJar {
outputSynopsis(w, h)
}
w.Flush()
if helpOutput != output.String() {
t.Errorf("expect:\n%s\noutput:\n%s\n", helpOutput, output.String())
}
}
const configHelpOutput = `Usage of comamnd '[33;1mconfig[0;m':
[31;1m*[0;m [32;1mconfig menu[0;m
Invoke 'make menuconfig' on the current kernel.
[32;1mconfig def[0;m
Invoke 'make defconfig' on the current kernel.
[32;1mconfig save[0;m
Save current config as the default config.
Invoke 'make savedefconfig' and then overwrite the original config file.
`
func Test_configHelpOutput(t *testing.T) {
gConfig = getConfig(false)
var output bytes.Buffer
w := tabwriter.NewWriter(&output, 0, 0, 1, ' ', tabwriter.TabIndent)
outputBanner(w, configHelp)
outputUsage(w, configHelp)
w.Flush()
if configHelpOutput != output.String() {
t.Errorf("expect:\n%s\noutput:\n%s\n", helpOutput, output.String())
}
}