github.com/markusbkk/elvish@v0.0.0-20231204143114-91dc52438621/pkg/eval/vals/pipe_test.go (about) 1 package vals 2 3 import ( 4 "fmt" 5 "testing" 6 7 "github.com/markusbkk/elvish/pkg/persistent/hash" 8 "github.com/markusbkk/elvish/pkg/testutil" 9 ) 10 11 func TestPipe(t *testing.T) { 12 pr, pw := testutil.MustPipe() 13 defer pr.Close() 14 defer pw.Close() 15 16 TestValue(t, NewPipe(pr, pw)). 17 Kind("pipe"). 18 Bool(true). 19 Hash(hash.DJB(hash.UIntPtr(pr.Fd()), hash.UIntPtr(pw.Fd()))). 20 Repr(fmt.Sprintf("<pipe{%v %v}>", pr.Fd(), pw.Fd())). 21 Equal(NewPipe(pr, pw)). 22 NotEqual(123, "a string", NewPipe(pw, pr)). 23 AllKeys("r", "w"). 24 Index("r", pr). 25 Index("w", pw) 26 }