mirror of
https://github.com/eosswedenorg/antelope-api-healthcheck
synced 2026-07-03 11:53:43 +02:00
Adding src/api/log_params_test.go
This commit is contained in:
parent
a550f67dca
commit
816a38acae
1 changed files with 34 additions and 0 deletions
34
src/api/log_params_test.go
Normal file
34
src/api/log_params_test.go
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
|
||||||
|
package api
|
||||||
|
|
||||||
|
import (
|
||||||
|
"testing"
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
func TestLogParams(t *testing.T) {
|
||||||
|
|
||||||
|
type test_struct struct {
|
||||||
|
First string
|
||||||
|
Second int
|
||||||
|
}
|
||||||
|
|
||||||
|
p := LogParams{}
|
||||||
|
|
||||||
|
p.Add("one", 1)
|
||||||
|
p.Add("string", "str")
|
||||||
|
p.Add("struct", test_struct{First:"first_string",Second:1234})
|
||||||
|
|
||||||
|
expected := []interface{}([]interface {}{
|
||||||
|
"one",1,
|
||||||
|
"string","str",
|
||||||
|
"struct",test_struct{
|
||||||
|
First:"first_string",
|
||||||
|
Second:1234,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
assert.Equal(t, expected, p.ToSlice())
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue