MCPcopy
hub / github.com/grafana/tempo / TestStringifyAnyValue

Function TestStringifyAnyValue

pkg/util/attributes_test.go:10–93  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

8)
9
10func TestStringifyAnyValue(t *testing.T) {
11 testCases := []struct {
12 name string
13 v *v1common.AnyValue
14 expected string
15 }{
16 {
17 name: "string value",
18 v: &v1common.AnyValue{
19 Value: &v1common.AnyValue_StringValue{
20 StringValue: "test",
21 },
22 },
23 expected: "test",
24 },
25 {
26 name: "int value",
27 v: &v1common.AnyValue{
28 Value: &v1common.AnyValue_IntValue{
29 IntValue: 1,
30 },
31 },
32 expected: "1",
33 },
34 {
35 name: "bool value",
36 v: &v1common.AnyValue{
37 Value: &v1common.AnyValue_BoolValue{
38 BoolValue: true,
39 },
40 },
41 expected: "true",
42 },
43 {
44 name: "float value",
45 v: &v1common.AnyValue{
46 Value: &v1common.AnyValue_DoubleValue{
47 DoubleValue: 1.1,
48 },
49 },
50 expected: "1.1",
51 },
52 {
53 name: "array value",
54 v: &v1common.AnyValue{
55 Value: &v1common.AnyValue_ArrayValue{
56 ArrayValue: &v1common.ArrayValue{
57 Values: []*v1common.AnyValue{
58 {
59 Value: &v1common.AnyValue_StringValue{
60 StringValue: "test",
61 },
62 },
63 },
64 },
65 },
66 },
67 expected: "[test]",

Callers

nothing calls this directly

Calls 3

StringifyAnyValueFunction · 0.85
RunMethod · 0.45
EqualMethod · 0.45

Tested by

no test coverage detected