1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2026-06-03 18:35:08 +02:00

Add test cases to TestEmit in attribute (#7751)

Add test cases for `Key.Emit()` values:

- `BoolSliceValue`
- `IntValue`
- `IntSliceValue`

---------

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
This commit is contained in:
Saharsh Tibrewala
2026-01-05 22:02:29 +05:30
committed by GitHub
parent a86bf87dd9
commit 3dc4cccef7
+15
View File
@@ -63,6 +63,11 @@ func TestEmit(t *testing.T) {
v: attribute.BoolValue(true),
want: "true",
},
{
name: `test Key.Emit() can emit a string representing self.BOOLSLICE`,
v: attribute.BoolSliceValue([]bool{true, false, true}),
want: `[true false true]`,
},
{
name: `test Key.Emit() can emit a string representing self.INT64SLICE`,
v: attribute.Int64SliceValue([]int64{1, 42}),
@@ -73,6 +78,16 @@ func TestEmit(t *testing.T) {
v: attribute.Int64Value(42),
want: "42",
},
{
name: `test Key.Emit() can representing an int value`,
v: attribute.IntValue(7),
want: "7",
},
{
name: `test Key.Emit() can represent an []int value`,
v: attribute.IntSliceValue([]int{1, 2, 3}),
want: `[1,2,3]`,
},
{
name: `test Key.Emit() can emit a string representing self.FLOAT64SLICE`,
v: attribute.Float64SliceValue([]float64{1.0, 42.5}),