xref: /aosp_15_r20/external/spdx-tools/builder/builder2v1/build_relationship_test.go (revision ba677afa8f67bb56cbc794f4d0e378e0da058e16)
1// SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
2
3package builder2v1
4
5import (
6	"testing"
7
8	"github.com/spdx/tools-golang/spdx/common"
9)
10
11// ===== Relationship section builder tests =====
12func TestBuilder2_1CanBuildRelationshipSection(t *testing.T) {
13	packageName := "project17"
14
15	rln, err := BuildRelationshipSection2_1(packageName)
16	if err != nil {
17		t.Fatalf("expected nil error, got %v", err)
18	}
19
20	if rln == nil {
21		t.Fatalf("expected non-nil relationship, got nil")
22	}
23	if rln.RefA != common.MakeDocElementID("", "DOCUMENT") {
24		t.Errorf("expected %v, got %v", "DOCUMENT", rln.RefA)
25	}
26	if rln.RefB != common.MakeDocElementID("", "Package-project17") {
27		t.Errorf("expected %v, got %v", "Package-project17", rln.RefB)
28	}
29	if rln.Relationship != "DESCRIBES" {
30		t.Errorf("expected %v, got %v", "DESCRIBES", rln.Relationship)
31	}
32
33}
34