-
Notifications
You must be signed in to change notification settings - Fork 2
/
specfile_test.go
37 lines (33 loc) · 990 Bytes
/
specfile_test.go
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
package specfile
import "testing"
func TestFindTag(t *testing.T) {
var spec Specfile
var tag Tag
token := NewTokenizer("Tag", "Name: gcc10\n")
tag.Parse(&token)
spec.append("Tags", tag)
if _, err := spec.FindTag("Name"); err != nil {
t.Error("[specfile]FindTag test failed")
}
}
func TestFindSection(t *testing.T) {
var spec Specfile
var section Section
token := NewTokenizer("Section", "%description -n gcc10-testresults\nResults from running the gcc and target library testsuites.")
section.Parse(&token)
spec.append("Sections", section)
if _, err := spec.FindSection("%description"); err != nil {
t.Error("[specfile]FindSection test failed")
}
}
func TestFindSubpackage(t *testing.T) {
var spec, spec1 Specfile
var tag Tag
token := NewTokenizer("Tag", "Name: gcc10\n")
tag.Parse(&token)
spec1.append("Tags", tag)
spec.append("Subpackages", spec1)
if _, err := spec.FindSubpackage("gcc10"); err != nil {
t.Error("[specfile]FindSubpackage test failed")
}
}