(t *testing.T)
| 92 | } |
| 93 | |
| 94 | func TestMapError(t *testing.T) { |
| 95 | t.Parallel() |
| 96 | |
| 97 | result1, err := MapError([]int64{1, 2, 3, 4}, func(x int64) (string, error) { |
| 98 | return strconv.FormatInt(x, 10), nil |
| 99 | }) |
| 100 | require.NoError(t, err) |
| 101 | require.Equal(t, []string{"1", "2", "3", "4"}, result1) |
| 102 | |
| 103 | _, err = MapError([]int64{1, 2, 3, 4}, func(x int64) (string, error) { |
| 104 | if x == 4 { |
| 105 | return "", errors.New("error on element 4") |
| 106 | } |
| 107 | return strconv.FormatInt(x, 10), nil |
| 108 | }) |
| 109 | require.EqualError(t, err, "error on element 4") |
| 110 | } |
| 111 | |
| 112 | func TestUniq(t *testing.T) { |
| 113 | t.Parallel() |
nothing calls this directly
no test coverage detected
searching dependent graphs…