nuclei/pkg/utils/insertion_ordered_map_test.go
Tarun Koyalwar dc44105baf
nuclei v3 : misc updates (#4247)
* use parsed options while signing

* update project layout to v3

* fix .gitignore

* remove example template

* misc updates

* bump tlsx version

* hide template sig warning with env

* js: retain value while using log

* fix nil pointer derefernce

* misc doc update

---------

Co-authored-by: sandeep <8293321+ehsandeep@users.noreply.github.com>
2023-10-17 17:44:13 +05:30

25 lines
524 B
Go

package utils
import (
"testing"
"github.com/stretchr/testify/require"
"gopkg.in/yaml.v2"
)
func TestUnmarshalInsertionOrderedMapYAML(t *testing.T) {
var data = `a1: test
a2: value
a3: new`
var value InsertionOrderedStringMap
err := yaml.Unmarshal([]byte(data), &value)
require.NoError(t, err, "could not unmarshal map")
var items []string
value.ForEach(func(key string, value interface{}) {
items = append(items, key)
})
require.Equal(t, []string{"a1", "a2", "a3"}, items, "could not get ordered keys")
}