From b5ba9ba573d61175b902f1bcd4d4f62dd454d636 Mon Sep 17 00:00:00 2001 From: dudaodong Date: Fri, 22 Jul 2022 10:17:23 +0800 Subject: [PATCH] fix: fix TestMapToSlice function result independent of order of elements --- convertor/convertor_test.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/convertor/convertor_test.go b/convertor/convertor_test.go index d6bbdc7..4970f9c 100644 --- a/convertor/convertor_test.go +++ b/convertor/convertor_test.go @@ -6,6 +6,7 @@ import ( "testing" "github.com/duke-git/lancet/v2/internal" + "github.com/duke-git/lancet/v2/slice" ) func TestToChar(t *testing.T) { @@ -204,7 +205,10 @@ func TestMapToSlice(t *testing.T) { return key + ":" + strconv.Itoa(value) }) - assert.Equal([]string{"a:1", "b:2", "c:3"}, result) + assert.Equal(3, len(result)) + assert.Equal(true, slice.Contain(result, "a:1")) + assert.Equal(true, slice.Contain(result, "b:2")) + assert.Equal(true, slice.Contain(result, "c:3")) } func TestColorHexToRGB(t *testing.T) {