github.com/m4gshm/gollections@v0.0.13-0.20240331203319-a34a86e58a24/loop/test/api_go_1_22_test.go (about)

     1  //go:build goexperiment.rangefunc
     2  
     3  package test
     4  
     5  import (
     6  	"testing"
     7  
     8  	"github.com/stretchr/testify/assert"
     9  
    10  	"github.com/m4gshm/gollections/loop"
    11  )
    12  
    13  func Test_IterAll(t *testing.T) {
    14  
    15  	r := []int{}
    16  	for v := range loop.Of(1, 3, 5, 7, 9, 11).All {
    17  		r = append(r, v)
    18  	}
    19  
    20  	assert.Equal(t, []int{1, 3, 5, 7, 9, 11}, r)
    21  }