Skip to content

Commit 59589ef

Browse files
author
New year
committed
addtypes: adding test for type Any
1 parent 4eba6c0 commit 59589ef

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

any_gen_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package option_test
22

33
import (
44
"bytes"
5-
"log"
65
"testing"
76

87
"github.com/stretchr/testify/assert"
@@ -176,11 +175,11 @@ func TestAny_EncodeDecodeMsgpack(t *testing.T) {
176175
expected any
177176
}{
178177
{"string", "test string", "test string"},
179-
{"int", 42, 42},
178+
{"int", 42, int64(42)},
180179
{"float", 3.14, 3.14},
181180
{"bool", true, true},
182-
{"slice", []int{1, 2, 3}, []any{1, 2, 3}},
183-
{"map", map[string]int{"a": 1}, map[string]any{"a": 1}},
181+
{"slice", []int{1, 2, 3}, []interface{}{int8(1), int8(2), int8(3)}},
182+
{"map", map[string]int{"a": 1}, map[string]interface{}{"a": int8(1)}},
184183
}
185184

186185
for _, tc := range testCases {
@@ -200,9 +199,10 @@ func TestAny_EncodeDecodeMsgpack(t *testing.T) {
200199
// Decode
201200
var unmarshaled option.Any
202201
err = unmarshaled.DecodeMsgpack(dec)
203-
log.Println("someAny", someAny)
202+
// log.Println("Error", err)
203+
// log.Println("someAny", someAny)
204204
require.NoError(t, err)
205-
log.Println("UNwrap", unmarshaled.Unwrap())
205+
// log.Println("UNwrap", unmarshaled.Unwrap())
206206
// Verify
207207
assert.True(t, unmarshaled.IsSome())
208208
assert.Equal(t, tc.expected, unmarshaled.Unwrap())

0 commit comments

Comments
 (0)