File: map_test.go

package info (click to toggle)
golang-github-anacrolix-missinggo 2.1.0-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 836 kB
  • sloc: makefile: 4
file content (16 lines) | stat: -rw-r--r-- 343 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
package slices

import (
	"testing"

	"github.com/stretchr/testify/assert"
)

func TestFromMap(t *testing.T) {
	sl := FromMap(map[string]int{"two": 2, "one": 1})
	assert.Len(t, sl, 2)
	Sort(sl, func(left, right MapItem) bool {
		return left.Key.(string) < right.Key.(string)
	})
	assert.EqualValues(t, []MapItem{{"one", 1}, {"two", 2}}, sl)
}