Files
Mellaris/analyzer/utils/string_test.go

30 lines
718 B
Go

package utils
import (
"reflect"
"testing"
)
func TestByteSlicesToStrings(t *testing.T) {
tests := []struct {
name string
input [][]byte
want []string
}{
{"nil", nil, []string{}},
{"empty", [][]byte{}, []string{}},
{"single", [][]byte{[]byte("hello")}, []string{"hello"}},
{"multiple", [][]byte{[]byte("foo"), []byte("bar"), []byte("baz")}, []string{"foo", "bar", "baz"}},
{"empty element", [][]byte{[]byte("a"), []byte{}, []byte("b")}, []string{"a", "", "b"}},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got := ByteSlicesToStrings(tt.input)
if !reflect.DeepEqual(got, tt.want) {
t.Errorf("ByteSlicesToStrings() = %v, want %v", got, tt.want)
}
})
}
}