-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathfwcfg_test.go
More file actions
41 lines (36 loc) · 848 Bytes
/
fwcfg_test.go
File metadata and controls
41 lines (36 loc) · 848 Bytes
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
package qcli
import "testing"
func TestAppendFwcfg(t *testing.T) {
fwcfgString := "-fw_cfg name=opt/com.mycompany/blob,file=./my_blob.bin"
fwcfg := FwCfg{
Name: "opt/com.mycompany/blob",
File: "./my_blob.bin",
}
testAppend(fwcfg, fwcfgString, t)
fwcfgString = "-fw_cfg name=opt/com.mycompany/blob,string=foo"
fwcfg = FwCfg{
Name: "opt/com.mycompany/blob",
Str: "foo",
}
testAppend(fwcfg, fwcfgString, t)
}
func TestBadFwcfg(t *testing.T) {
c := &Config{}
c.appendFwCfg(nil)
if len(c.qemuParams) != 0 {
t.Errorf("Expected empty qemuParams, found %s", c.qemuParams)
}
c = &Config{
FwCfg: []FwCfg{
{
Name: "name=opt/com.mycompany/blob",
File: "./my_blob.bin",
Str: "foo",
},
},
}
c.appendFwCfg(nil)
if len(c.qemuParams) != 0 {
t.Errorf("Expected empty qemuParams, found %s", c.qemuParams)
}
}