1
1
Fork 0
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:
Carlos Alexandro Becker 2018-02-25 17:29:31 -03:00
parent 20c7fa9722
commit 9b70ad6db6
No known key found for this signature in database
GPG Key ID: E61E2F7DC14AB940

View File

@ -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))
})
}
}