From a7b6562bf28053250f80837203e494a0e8081382 Mon Sep 17 00:00:00 2001 From: mehrdadbn9 Date: Sun, 15 Feb 2026 09:14:24 +0330 Subject: [PATCH] test: add tests for LatencyColor blue case and MarshalXML success case --- logger_test.go | 1 + utils_test.go | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/logger_test.go b/logger_test.go index 53d0df95..2d22c6e1 100644 --- a/logger_test.go +++ b/logger_test.go @@ -329,6 +329,7 @@ func TestColorForLatency(t *testing.T) { assert.Equal(t, white, colorForLantency(time.Millisecond*20), "20ms should be white") assert.Equal(t, green, colorForLantency(time.Millisecond*150), "150ms should be green") assert.Equal(t, cyan, colorForLantency(time.Millisecond*250), "250ms should be cyan") + assert.Equal(t, blue, colorForLantency(time.Millisecond*400), "400ms should be blue") assert.Equal(t, yellow, colorForLantency(time.Millisecond*600), "600ms should be yellow") assert.Equal(t, magenta, colorForLantency(time.Millisecond*1500), "1.5s should be magenta") assert.Equal(t, red, colorForLantency(time.Second*3), "other things should be red") diff --git a/utils_test.go b/utils_test.go index 893ebc88..ee91bddd 100644 --- a/utils_test.go +++ b/utils_test.go @@ -13,6 +13,7 @@ import ( "testing" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" ) func init() { @@ -145,6 +146,17 @@ func TestMarshalXMLforH(t *testing.T) { assert.Error(t, e) } +func TestMarshalXMLforHSuccess(t *testing.T) { + h := H{ + "key": "value", + "number": 42, + } + data, err := xml.Marshal(h) + require.NoError(t, err) + assert.Contains(t, string(data), "value") + assert.Contains(t, string(data), "42") +} + func TestIsASCII(t *testing.T) { assert.True(t, isASCII("test")) assert.False(t, isASCII("๐Ÿงก๐Ÿ’›๐Ÿ’š๐Ÿ’™๐Ÿ’œ"))