File: build_relationship_test.go

package info (click to toggle)
golang-github-spdx-tools-golang 0.5.5-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 3,252 kB
  • sloc: xml: 428; makefile: 22; ansic: 5; python: 2
file content (33 lines) | stat: -rw-r--r-- 839 bytes parent folder | download
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
// SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later

package builder

import (
	"testing"

	"github.com/spdx/tools-golang/spdx/v2/common"
)

// ===== Relationship section builder tests =====
func TestBuilderCanBuildRelationshipSection(t *testing.T) {
	packageName := "project17"

	rln, err := BuildRelationshipSection(packageName)
	if err != nil {
		t.Fatalf("expected nil error, got %v", err)
	}

	if rln == nil {
		t.Fatalf("expected non-nil relationship, got nil")
	}
	if rln.RefA != common.MakeDocElementID("", "DOCUMENT") {
		t.Errorf("expected %v, got %v", "DOCUMENT", rln.RefA)
	}
	if rln.RefB != common.MakeDocElementID("", "Package-project17") {
		t.Errorf("expected %v, got %v", "Package-project17", rln.RefB)
	}
	if rln.Relationship != "DESCRIBES" {
		t.Errorf("expected %v, got %v", "DESCRIBES", rln.Relationship)
	}

}