Skip to content

Commit

Permalink
feat(test): add unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
dongzl committed Sep 4, 2023
1 parent ab4f0a3 commit 3eae991
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions pkg/util/runes/rune_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package runes

import (
"reflect"
"testing"
)

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

func TestConvertToRune(t *testing.T) {
tests := []struct {
input interface{}
output []rune
}{
{123, []rune("123")},
{"hello", []rune("hello")},
{true, []rune("true")},
{nil, []rune("<nil>")},
{struct{ name string }{name: "John"}, []rune("{John}")},
}

for _, test := range tests {
result := ConvertToRune(test.input)
assert.True(t, reflect.DeepEqual(result, test.output))
}
}

0 comments on commit 3eae991

Please sign in to comment.