forked from gobuffalo/genny
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreplacer_test.go
More file actions
37 lines (30 loc) · 737 Bytes
/
replacer_test.go
File metadata and controls
37 lines (30 loc) · 737 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
package genny
import (
"testing"
"github.com/stretchr/testify/require"
)
func Test_Replace(t *testing.T) {
r := require.New(t)
table := []struct {
in string
out string
search string
replace string
}{
{in: "foo/-dot-git-keep", out: "foo/.git-keep", search: "-dot-", replace: "."},
{in: "foo/dot-git-keep", out: "foo/dot-git-keep", search: "-dot-", replace: "."},
}
for _, tt := range table {
in := NewFile(tt.in, nil)
out, err := Replace(tt.search, tt.replace).Transform(in)
r.NoError(err)
r.Equal(tt.out, out.Name())
}
}
func Test_Dot(t *testing.T) {
r := require.New(t)
f := NewFile("-dot-travis.yml", nil)
f, err := Dot().Transform(f)
r.NoError(err)
r.Equal(".travis.yml", f.Name())
}