func TestErrorMessages(t *testing.T) {
	testCases := []struct {
		input          []error
		expectedOutput []string
	}{
		{input: []error{}, expectedOutput: []string{}},
		{input: []error{errors.New("some error")}, expectedOutput: []string{"some error"}},
		{input: []error{errors.New("some error"), errors.New("another error")}, expectedOutput: []string{"some error", "another error"}},
	}
	for i, testCase := range testCases {
		t.Run(fmt.Sprintf("Test errpr message extraction %d", i), func(t *testing.T) {
			output := ErrorMessages(testCase.input)
			assert.NotNil(t, output)
			assert.Equal(t, testCase.expectedOutput, output)
		})
	}
}
TestErrorMessages tests the error message extraction on various examples.
package stringutils
import (
	"errors"
	"fmt"
	"sort"
	"strings"
	"testing"
	"github.com/stretchr/testify/assert"
)
func TestTransform(t *testing.T) {
	strs := []string{"a", "b", "c"}
	allupper := Transform(strs, strings.ToUpper)
	assert.Len(t, allupper, len(strs))
	assert.Equal(t, "A", allupper[0])
	assert.Equal(t, "B", allupper[1])
	assert.Equal(t, "C", allupper[2])
}
func TestQuote(t *testing.T) {
	strs := []string{"a", "b", "c"}
	quoted := Quote(strs)
	assert.Len(t, quoted, len(strs))
	assert.Equal(t, "\"a\"", quoted[0])
	assert.Equal(t, "\"b\"", quoted[1])
	assert.Equal(t, "\"c\"", quoted[2])
}
func TestDefaultIfEmpty(t *testing.T) {
	assert.Equal(t, "AA", DefaultIfEmpty("AA", "BB"))
	assert.Equal(t, "BB", DefaultIfEmpty("", "BB"))
	assert.Equal(t, "", DefaultIfEmpty("", ""))
	var a string
	assert.Equal(t, "XX", DefaultIfEmpty(a, "XX"))
}
func TestStringKeysAndValues(t *testing.T) {
	testCases := []struct {
		input        map[string]string
		expectedKeys []string
	}{
		{input: map[string]string{}, expectedKeys: []string{}},
		{input: map[string]string{"foo": "a", "bar": "b"}, expectedKeys: []string{"foo", "bar"}},
	}
	for i, testCase := range testCases {
		t.Run(fmt.Sprintf("Test string key extraction %d", i), func(t *testing.T) {
			keys := Keys(testCase.input)
			assert.NotNil(t, keys)
			sort.Strings(testCase.expectedKeys)
			sort.Strings(keys)
			assert.Equal(t, testCase.expectedKeys, keys)
		})
	}
}