-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Minor optimizations per lint results
- Loading branch information
Showing
3 changed files
with
51 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package logger | ||
|
||
import "testing" | ||
|
||
// TestMakeParameter test making an error struct and MakeParameter() method | ||
func TestMakeParameter(t *testing.T) { | ||
param := MakeParameter("myKey", "myValue") | ||
if param.Key() != "myKey" { | ||
t.Fatalf("expected value: %s, got: %s", "myKey", param.Key()) | ||
} | ||
if param.Value() != "myValue" { | ||
t.Fatalf("expected value: %s, got: %s", "myValue", param.Value()) | ||
} | ||
if param.String() != `{"key":"myKey","value":"myValue"}` { | ||
t.Fatalf("expected value: %s, got: %s", `{"key":"myKey","value":"myValue"}`, param.String()) | ||
} | ||
} | ||
|
||
// BenchmarkMakeParameter benchmarks the MakeParameter() method | ||
func BenchmarkMakeParameter(b *testing.B) { | ||
for i := 0; i < b.N; i++ { | ||
_ = MakeParameter("myKey", "myValue") | ||
} | ||
} |