github.com/wuhuizuo/gomplate@v3.5.0+incompatible/tests/integration/sockaddr_test.go (about) 1 //+build integration 2 3 package integration 4 5 import ( 6 . "gopkg.in/check.v1" 7 8 "github.com/gotestyourself/gotestyourself/icmd" 9 ) 10 11 type SockaddrSuite struct{} 12 13 var _ = Suite(&SockaddrSuite{}) 14 15 func (s *SockaddrSuite) TestSockaddr(c *C) { 16 result := icmd.RunCommand(GomplateBin, "-i", 17 `{{ range (sockaddr.GetAllInterfaces | sockaddr.Include "type" "ipv4") -}} 18 {{ . | sockaddr.Attr "address" }} 19 {{end}}`) 20 result.Assert(c, icmd.Expected{ExitCode: 0, Out: "127.0.0.1"}) 21 }