Compare commits
No commits in common. "83dd096a9a24f2214bc68056c5be930efa5fbff8" and "6d70d9dd0e8437426477e2aac908c8603ef45431" have entirely different histories.
83dd096a9a
...
6d70d9dd0e
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +0,0 @@
|
|||||||
*.swp
|
|
@ -67,6 +67,7 @@ func TestLoad(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "test load json file with default",
|
name: "test load json file with default",
|
||||||
args: args{
|
args: args{
|
||||||
|
i: &Config{},
|
||||||
opts: &LoadOptions{
|
opts: &LoadOptions{
|
||||||
ConfigFile: &ConfigFile{
|
ConfigFile: &ConfigFile{
|
||||||
Type: ConfigFileTypeJSON,
|
Type: ConfigFileTypeJSON,
|
||||||
@ -79,6 +80,7 @@ func TestLoad(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "test load yaml file with default",
|
name: "test load yaml file with default",
|
||||||
args: args{
|
args: args{
|
||||||
|
i: &Config{},
|
||||||
opts: &LoadOptions{
|
opts: &LoadOptions{
|
||||||
ConfigFile: &ConfigFile{
|
ConfigFile: &ConfigFile{
|
||||||
Type: ConfigFileTypeYAML,
|
Type: ConfigFileTypeYAML,
|
||||||
@ -91,6 +93,7 @@ func TestLoad(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "test load toml file with default",
|
name: "test load toml file with default",
|
||||||
args: args{
|
args: args{
|
||||||
|
i: &Config{},
|
||||||
opts: &LoadOptions{
|
opts: &LoadOptions{
|
||||||
ConfigFile: &ConfigFile{
|
ConfigFile: &ConfigFile{
|
||||||
Type: ConfigFileTypeTOML,
|
Type: ConfigFileTypeTOML,
|
||||||
@ -103,6 +106,7 @@ func TestLoad(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "test load json file with default and env",
|
name: "test load json file with default and env",
|
||||||
args: args{
|
args: args{
|
||||||
|
i: &Config{},
|
||||||
opts: &LoadOptions{
|
opts: &LoadOptions{
|
||||||
ConfigFile: &ConfigFile{
|
ConfigFile: &ConfigFile{
|
||||||
Type: ConfigFileTypeJSON,
|
Type: ConfigFileTypeJSON,
|
||||||
@ -116,17 +120,15 @@ func TestLoad(t *testing.T) {
|
|||||||
}
|
}
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
src := Config{}
|
|
||||||
tt.args.i = &src
|
|
||||||
if err := Load(tt.args.i, tt.args.opts); (err != nil) != tt.wantErr {
|
if err := Load(tt.args.i, tt.args.opts); (err != nil) != tt.wantErr {
|
||||||
t.Errorf("Load() error = %v, wantErr %v", err, tt.wantErr)
|
t.Errorf("Load() error = %v, wantErr %v", err, tt.wantErr)
|
||||||
}
|
}
|
||||||
if tt.args.opts != nil && tt.args.opts.FromEnv {
|
if tt.args.opts != nil && tt.args.opts.FromEnv {
|
||||||
if !reflect.DeepEqual(src, expectedWithEnv) {
|
if !reflect.DeepEqual(tt.args.i, expectedWithEnv) {
|
||||||
t.Errorf("Load and expected not match")
|
t.Errorf("Load and expected not match")
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if !reflect.DeepEqual(src, expected) {
|
if !reflect.DeepEqual(tt.args.i, expected) {
|
||||||
t.Errorf("Load and expected not match")
|
t.Errorf("Load and expected not match")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user