forked from thought-machine/please
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstamp_test.go
More file actions
41 lines (38 loc) · 928 Bytes
/
Copy pathstamp_test.go
File metadata and controls
41 lines (38 loc) · 928 Bytes
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
38
39
40
41
package core
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestStampFile(t *testing.T) {
t1 := NewBuildTarget(ParseBuildLabel("//src/core:core", ""))
t2 := NewBuildTarget(ParseBuildLabel("//src/fs:fs", ""))
t3 := NewBuildTarget(ParseBuildLabel("//third_party/go:errors", ""))
t1.AddLabel("go")
t3.AddLabel("go_get:github.com/pkg/errors")
t3.AddLicence("bsd-2-clause")
t1.AddDependency(t2.Label)
t1.resolveDependency(t2.Label, t2)
t1.AddDependency(t3.Label)
t1.resolveDependency(t3.Label, t3)
t2.AddDependency(t3.Label)
t2.resolveDependency(t3.Label, t3)
expected := []byte(`{
"targets": {
"//src/core:core": {
"labels": [
"go"
]
},
"//src/fs:fs": {},
"//third_party/go:errors": {
"labels": [
"go_get:github.com/pkg/errors"
],
"licences": [
"bsd-2-clause"
]
}
}
}`)
assert.Equal(t, expected, StampFile(t1))
}