mirror of
https://github.com/go-sylixos/elvish.git
synced 2024-12-05 03:17:50 +08:00
27 lines
504 B
Go
27 lines
504 B
Go
package vals
|
|
|
|
import (
|
|
"fmt"
|
|
"testing"
|
|
|
|
"src.elv.sh/pkg/must"
|
|
"src.elv.sh/pkg/persistent/hash"
|
|
)
|
|
|
|
func TestPipe(t *testing.T) {
|
|
pr, pw := must.Pipe()
|
|
defer pr.Close()
|
|
defer pw.Close()
|
|
|
|
TestValue(t, NewPipe(pr, pw)).
|
|
Kind("pipe").
|
|
Bool(true).
|
|
Hash(hash.DJB(hash.UIntPtr(pr.Fd()), hash.UIntPtr(pw.Fd()))).
|
|
Repr(fmt.Sprintf("<pipe{%v %v}>", pr.Fd(), pw.Fd())).
|
|
Equal(NewPipe(pr, pw)).
|
|
NotEqual(123, "a string", NewPipe(pw, pr)).
|
|
AllKeys("r", "w").
|
|
Index("r", pr).
|
|
Index("w", pw)
|
|
}
|