github.com/m4gshm/gollections@v0.0.13-0.20240331203319-a34a86e58a24/internal/examples/expressionexamples/last_Of_test.go (about)

     1  package sliceexamples
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/stretchr/testify/assert"
     7  
     8  	"github.com/m4gshm/gollections/expr/last"
     9  	"github.com/m4gshm/gollections/predicate/less"
    10  )
    11  
    12  func Test_Last(t *testing.T) {
    13  
    14  	result, ok := last.Of(1, 3, 5, 7, 9, 11).By(less.Than(9)) //7, true
    15  
    16  	assert.True(t, ok)
    17  	assert.Equal(t, 7, result)
    18  }