package common
import (
"testing"
)
func TestParseProjectMeta(t *testing.T) {
res, err := parseProjectMeta([]byte(metaPrjData))
if err != nil {
t.Fatal(err)
}
if len(res.BuildFlags.Contents) < 1 {
t.Fatalf("Build flags are not as expected")
}
}
func TestParsingOfBuildResults(t *testing.T) {
res, err := parseBuildResults([]byte(buildResultData))
if err != nil {
t.Fatal(err)
}
if res.Result[0].Project != "home:adamm" ||
res.Result[0].Status[1].Details != "nothing provides libBox2D-devel" ||
res.Result[0].Status[0].Code != "excluded" {
t.Fatal(res.Result)
}
if res.Result[0].Binaries[0].Package != "Nudoku" ||
len(res.Result[0].Binaries[0].Binary) != 0 {
t.Fatal(res.Result[0].Binaries[0])
}
}
const metaPrjData = `
Adam's Home Projects
x86_64
aarch64
aarch64
aarch64
`
const buildResultData = `
nothing provides libBox2D-devel
nothing provides libBox2D-devel
conflict in file _service
no source uploaded
nothing provides libBox2D-devel
nothing provides libBox2D-devel
conflict in file _service
no source uploaded
conflict in file _service
no source uploaded
conflict in file _service
have choice for /usr/bin/openssl needed by opendkim: libressl openssl-1_0_0 openssl-3
no source uploaded
`