-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoptions_test.go
43 lines (37 loc) · 896 Bytes
/
options_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
package configuration_secret_files
import (
"github.com/stretchr/testify/require"
"testing"
)
func TestWithDirectory(t *testing.T) {
t.Parallel()
cfg := &Options{}
WithDirectory("/a/path").apply(cfg)
require.Equal(t, "/a/path", cfg.Directory)
}
func TestWithTag(t *testing.T) {
t.Parallel()
cfg := &Options{}
WithTag("tag").apply(cfg)
require.Equal(t, "tag", cfg.Tag)
}
func TestWithMaxSize(t *testing.T) {
t.Parallel()
cfg := &Options{}
WithMaxSize(42).apply(cfg)
require.Equal(t, int64(42), cfg.MaxSize)
}
func TestWithDirectoryMustExist(t *testing.T) {
t.Parallel()
cfg := &Options{}
WithDirectoryMustExist(true).apply(cfg)
require.Equal(t, true, cfg.DirectoryMustExist)
}
func TestFuncOption(t *testing.T) {
t.Parallel()
cfg := &Options{}
newFuncOption(func(opts *Options) {
opts.Directory = "/a/path"
}).apply(cfg)
require.Equal(t, "/a/path", cfg.Directory)
}