mirror of
https://github.com/goreleaser/nfpm
synced 2024-05-27 17:16:12 +02:00
test: deb: added more tests
This commit is contained in:
parent
20c7fa9722
commit
9b70ad6db6
|
@ -3,6 +3,7 @@ package deb
|
|||
import (
|
||||
"bytes"
|
||||
"flag"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"testing"
|
||||
|
||||
|
@ -41,7 +42,8 @@ var info = nfpm.WithDefaults(nfpm.Info{
|
|||
Homepage: "http://carlosbecker.com",
|
||||
Vendor: "nope",
|
||||
Files: map[string]string{
|
||||
"../testdata/fake": "/usr/local/bin/fake",
|
||||
"../testdata/fake": "/usr/local/bin/fake",
|
||||
"../testdata/whatever.conf": "/usr/share/doc/fake/fake.txt",
|
||||
},
|
||||
ConfigFiles: map[string]string{
|
||||
"../testdata/whatever.conf": "/etc/fake/fake.conf",
|
||||
|
@ -131,9 +133,13 @@ func TestConffiles(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestPathsToCreate(t *testing.T) {
|
||||
assert.Equal(
|
||||
t,
|
||||
[]string{"usr", "usr/share", "usr/share/doc", "usr/share/doc/whatever"},
|
||||
pathsToCreate("/usr/share/doc/whatever/foo.md"),
|
||||
)
|
||||
for path, parts := range map[string][]string{
|
||||
"/usr/share/doc/whatever/foo.md": []string{"usr", "usr/share", "usr/share/doc", "usr/share/doc/whatever"},
|
||||
"/var/moises": []string{"var"},
|
||||
"/": []string{},
|
||||
} {
|
||||
t.Run(fmt.Sprintf("path: '%s'", path), func(t *testing.T) {
|
||||
assert.Equal(t, parts, pathsToCreate(path))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue