Skip to content

Commit 66f7313

Browse files
committed
Support assert.Empty for string in test
1 parent 2141361 commit 66f7313

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

internal/assert/assert.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ func SliceEqual[T comparable](t *testing.T, a, b []T) {
5757
}
5858
}
5959

60-
func Empty[T any](t *testing.T, items []T) {
60+
func Empty[S any, T []S | ~string](t *testing.T, items T) {
6161
t.Helper()
6262

6363
if len(items) != 0 {

iter/filter_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ func TestFilterMapEmpty(t *testing.T) {
123123
selectEvenAndDouble,
124124
)
125125

126-
assert.Empty(t, iter.Collect(fltMapEmpty))
126+
assert.Empty[int](t, iter.Collect(fltMapEmpty))
127127
}
128128

129129
func TestFilterMapExhausted(t *testing.T) {

iter/iter_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func TestCollect(t *testing.T) {
4242

4343
func TestCollectEmpty(t *testing.T) {
4444
items := iter.Collect[int](iter.Take[int](iter.Count(), 0))
45-
assert.Empty(t, items)
45+
assert.Empty[int](t, items)
4646
}
4747

4848
func TestFold(t *testing.T) {

iter/map_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ func TestMap(t *testing.T) {
3030
func TestMapEmpty(t *testing.T) {
3131
double := func(a int) int { return a * 2 }
3232
items := iter.Collect[int](iter.Map[int](iter.Exhausted[int](), double))
33-
assert.Empty(t, items)
33+
assert.Empty[int](t, items)
3434
}
3535

3636
func TestMapExhausted(t *testing.T) {

0 commit comments

Comments
 (0)