(t *testing.T)
| 281 | } |
| 282 | |
| 283 | func TestBool(t *testing.T) { |
| 284 | tests := []struct { |
| 285 | name string |
| 286 | key string |
| 287 | value bool |
| 288 | expected map[string]any |
| 289 | }{ |
| 290 | { |
| 291 | name: "true bool", |
| 292 | key: "enabled", |
| 293 | value: true, |
| 294 | expected: map[string]any{ |
| 295 | "enabled": true, |
| 296 | }, |
| 297 | }, |
| 298 | { |
| 299 | name: "false bool", |
| 300 | key: "disabled", |
| 301 | value: false, |
| 302 | expected: map[string]any{ |
| 303 | "disabled": false, |
| 304 | }, |
| 305 | }, |
| 306 | } |
| 307 | |
| 308 | for _, tt := range tests { |
| 309 | t.Run(tt.name, func(t *testing.T) { |
| 310 | // Test memory allocations |
| 311 | allocs := testing.AllocsPerRun(100, func() { |
| 312 | _ = Bool(tt.key, tt.value) |
| 313 | }) |
| 314 | require.Equal(t, float64(0), allocs, "Bool() should not allocate memory") |
| 315 | |
| 316 | // Test output format |
| 317 | param := Bool(tt.key, tt.value) |
| 318 | |
| 319 | jw := contentlog.NewJSONWriter() |
| 320 | defer jw.Release() |
| 321 | |
| 322 | jw.BeginObject() |
| 323 | param.WriteValueTo(jw) |
| 324 | jw.EndObject() |
| 325 | |
| 326 | var result map[string]any |
| 327 | |
| 328 | require.NoError(t, json.Unmarshal(jw.GetBufferForTesting(), &result)) |
| 329 | require.Equal(t, tt.expected, result) |
| 330 | }) |
| 331 | } |
| 332 | } |
| 333 | |
| 334 | func TestTime(t *testing.T) { |
| 335 | now := clock.Now() |
nothing calls this directly
no test coverage detected