github.com/elves/elvish@v0.15.0/pkg/eval/vals/feed_test.go (about)

     1  package vals
     2  
     3  import (
     4  	"reflect"
     5  	"testing"
     6  )
     7  
     8  func TestFeed(t *testing.T) {
     9  	var fed []interface{}
    10  
    11  	Feed(func(x interface{}) bool {
    12  		fed = append(fed, x)
    13  		return x != 10
    14  	}, 1, 2, 3, 10, 11, 12, 13)
    15  
    16  	wantFed := []interface{}{1, 2, 3, 10}
    17  	if !reflect.DeepEqual(fed, wantFed) {
    18  		t.Errorf("Fed %v, want %v", fed, wantFed)
    19  	}
    20  }