github.com/kolbycrouch/elvish@v0.14.1-0.20210614162631-215b9ac1c423/pkg/eval/vals/pipe_test.go (about) 1 package vals 2 3 import ( 4 "fmt" 5 "testing" 6 7 "src.elv.sh/pkg/persistent/hash" 8 "src.elv.sh/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 }