-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgitfs_test.go
46 lines (42 loc) · 1.19 KB
/
gitfs_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
38
39
40
41
42
43
44
45
46
// Code generated by gitfs; DO NOT EDIT
package main
import (
"context"
"testing"
"github.com/posener/gitfs"
"github.com/posener/gitfs/fsutil"
)
// TestGitfs checks that packed binary matches the local conent.
// To skip generating this test run gitfs with -skip-test-gen flag.
func TestGitfs(t *testing.T) {
ctx := context.Background()
projects := []struct {
project string
glob []string
}{
{
project: "github.com/JaneliaSciComp/maru/templates",
},
}
for _, tt := range projects {
t.Run(tt.project, func(t *testing.T) {
binary, err := gitfs.New(ctx, tt.project, gitfs.OptGlob(tt.glob...))
if err != nil {
t.Fatalf("Failed loading binary project %q: %s", tt.project, err)
}
local, err := gitfs.New(ctx, tt.project, gitfs.OptLocal("."), gitfs.OptGlob(tt.glob...))
if err != nil {
t.Fatalf("Failed loading local project %q: %s", tt.project, err)
}
diff, err := fsutil.Diff(local, binary)
if err != nil {
t.Fatalf("Failed performing filesystem diff: %s", err)
}
diff.A = "local"
diff.B = "binary"
if d := diff.String(); d != "" {
t.Errorf("Filesystem was modified after last binary generated. Please regenerae.\nDiff:\n%s", d)
}
})
}
}