github.com/binbinly/pkg@v0.0.11-0.20240321014439-f4fbf666eb0f/util/map_test.go (about)

     1  package util
     2  
     3  import (
     4  	"github.com/stretchr/testify/assert"
     5  	"testing"
     6  )
     7  
     8  func TestMapSortString(t *testing.T) {
     9  	type args struct {
    10  		m map[string]any
    11  	}
    12  	tests := []struct {
    13  		name string
    14  		args args
    15  		want map[string]any
    16  	}{
    17  		{
    18  			name: "TestMapSortString",
    19  			args: args{m: map[string]any{"b": 2, "a": 1, "c": 3}},
    20  			want: map[string]any{"a": 1, "b": 2, "c": 3},
    21  		},
    22  	}
    23  	for _, tt := range tests {
    24  		t.Run(tt.name, func(t *testing.T) {
    25  			assert.Equalf(t, tt.want, MapSortString(tt.args.m), "MapSortString(%v)", tt.args.m)
    26  		})
    27  	}
    28  }