Skip to content

Commit

Permalink
Extract const.
Browse files Browse the repository at this point in the history
  • Loading branch information
andreiavrammsd committed Nov 22, 2019
1 parent a8c0c64 commit 845f130
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,16 +168,16 @@ func TestJson(t *testing.T) {
}
}

const parseErrorInput = "STRUCT_KEY=text"

func TestWithIntParseError(t *testing.T) {
config := struct {
Struct struct {
Key int
}
}{}

input := "STRUCT_KEY=text"

if err := Load(&config).String(input); err == nil {
if err := Load(&config).String(parseErrorInput); err == nil {
t.Error("expected parse error")
}
}
Expand All @@ -189,9 +189,7 @@ func TestWithUintParseError(t *testing.T) {
}
}{}

input := "STRUCT_KEY=text"

if err := Load(&config).String(input); err == nil {
if err := Load(&config).String(parseErrorInput); err == nil {
t.Error("expected parse error")
}
}
Expand All @@ -203,9 +201,7 @@ func TestWithFloatParseError(t *testing.T) {
}
}{}

input := "STRUCT_KEY=text"

if err := Load(&config).String(input); err == nil {
if err := Load(&config).String(parseErrorInput); err == nil {
t.Error("expected parse error")
}
}
Expand All @@ -217,9 +213,7 @@ func TestWithBoolParseError(t *testing.T) {
}
}{}

input := "STRUCT_KEY=text"

if err := Load(&config).String(input); err == nil {
if err := Load(&config).String(parseErrorInput); err == nil {
t.Error("expected parse error")
}
}
Expand Down

0 comments on commit 845f130

Please sign in to comment.