diff options
author | Gabriel A. Giovanini <mail@gabrielgio.me> | 2024-06-09 19:35:34 +0200 |
---|---|---|
committer | Gabriel A. Giovanini <mail@gabrielgio.me> | 2024-06-09 19:35:34 +0200 |
commit | 02614b3781f6acdfc6df0e7b07d856b2779c4ac7 (patch) | |
tree | f23518fcf263be3236265852ba338c4fec137b41 /pkg/u/list_test.go | |
parent | b1ad6e98445cf7dafa6fec1e2e769051fe7cb748 (diff) | |
download | cerrado-02614b3781f6acdfc6df0e7b07d856b2779c4ac7.tar.gz cerrado-02614b3781f6acdfc6df0e7b07d856b2779c4ac7.tar.bz2 cerrado-02614b3781f6acdfc6df0e7b07d856b2779c4ac7.zip |
feat: Per repository configuration
Diffstat (limited to 'pkg/u/list_test.go')
-rw-r--r-- | pkg/u/list_test.go | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/pkg/u/list_test.go b/pkg/u/list_test.go index 805a209..3a856b9 100644 --- a/pkg/u/list_test.go +++ b/pkg/u/list_test.go @@ -3,6 +3,7 @@ package u import ( + "strconv" "testing" "github.com/google/go-cmp/cmp" @@ -129,3 +130,32 @@ func TestFirstOrZero(t *testing.T) { }) } } + +func TestMap(t *testing.T) { + testCases := []struct { + name string + in []int + out []string + }{ + { + name: "empty", + in: []int{}, + out: []string{}, + }, + { + name: "not empty", + in: []int{1, 2, 3}, + out: []string{"1", "2", "3"}, + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + out := Map(tc.in, func(v int) string { return strconv.Itoa(v) }) + + if diff := cmp.Diff(tc.out, out); diff != "" { + t.Errorf("Map error:\n%s", diff) + } + }) + } +} |