Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
projectdiscovery
GitHub Repository: projectdiscovery/nuclei
Path: blob/dev/pkg/utils/insertion_ordered_map_test.go
2070 views
1
package utils
2
3
import (
4
"testing"
5
6
"github.com/stretchr/testify/require"
7
"gopkg.in/yaml.v2"
8
)
9
10
func TestUnmarshalInsertionOrderedMapYAML(t *testing.T) {
11
var data = `a1: test
12
a2: value
13
a3: new`
14
15
var value InsertionOrderedStringMap
16
err := yaml.Unmarshal([]byte(data), &value)
17
require.NoError(t, err, "could not unmarshal map")
18
19
var items []string
20
value.ForEach(func(key string, value interface{}) {
21
items = append(items, key)
22
})
23
require.Equal(t, []string{"a1", "a2", "a3"}, items, "could not get ordered keys")
24
}
25
26