Skip to content

Commit a8e6668

Browse files
committed
test: log.TypeOf()
1 parent b6d5cdb commit a8e6668

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

log/value.libevm_test.go

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// Copyright 2025 the libevm authors.
2+
//
3+
// The libevm additions to go-ethereum are free software: you can redistribute
4+
// them and/or modify them under the terms of the GNU Lesser General Public License
5+
// as published by the Free Software Foundation, either version 3 of the License,
6+
// or (at your option) any later version.
7+
//
8+
// The libevm additions are distributed in the hope that they will be useful,
9+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
11+
// General Public License for more details.
12+
//
13+
// You should have received a copy of the GNU Lesser General Public License
14+
// along with the go-ethereum library. If not, see
15+
// <http://www.gnu.org/licenses/>.
16+
17+
package log
18+
19+
import (
20+
"testing"
21+
22+
"github.com/stretchr/testify/assert"
23+
)
24+
25+
func TestTypeOf(t *testing.T) {
26+
type foo struct{}
27+
28+
tests := map[any]string{
29+
nil: "<nil>",
30+
int(0): "int",
31+
int(1): "int",
32+
uint(0): "uint",
33+
foo{}: "log.foo",
34+
}
35+
36+
for in, want := range tests {
37+
got := TypeOf(in).LogValue()
38+
assert.Equalf(t, want, got.String(), "TypeOf(%T(%[1]v))", in, in)
39+
}
40+
}

0 commit comments

Comments
 (0)