1
0
Fork 0
out-of-tree/artifact/artifact_test.go

37 lines
609 B
Go
Raw Permalink Normal View History

2024-02-20 13:25:31 +00:00
package artifact
2018-11-23 09:00:30 +00:00
import (
"testing"
"code.dumpstack.io/tools/out-of-tree/distro"
2018-11-23 09:00:30 +00:00
"github.com/naoina/toml"
)
func TestMarshalUnmarshal(t *testing.T) {
artifactCfg := Artifact{
Name: "Put name here",
Type: KernelModule,
}
artifactCfg.Targets = append(artifactCfg.Targets,
Target{
Distro: distro.Distro{
ID: distro.Ubuntu,
Release: "18.04",
},
Kernel: Kernel{
Regex: ".*",
},
})
2018-11-23 09:00:30 +00:00
buf, err := toml.Marshal(&artifactCfg)
if err != nil {
t.Fatal(err)
}
var artifactCfgNew Artifact
err = toml.Unmarshal(buf, &artifactCfgNew)
if err != nil {
t.Fatal(err)
}
}