22 lines
250 B
Go
22 lines
250 B
Go
package pipeline
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestPipe(t *testing.T) {
|
|
a := make(chan int, 1)
|
|
|
|
pipe := func(in int) int {
|
|
return in * 2
|
|
}
|
|
|
|
b := Pipe(a, pipe)
|
|
a <- 5
|
|
close(a)
|
|
|
|
assert.Equal(t, 10, <-b)
|
|
}
|