本文整理汇总了Golang中github.com/juju/juju/cmd/jujud/agent/util.Housing.Filter方法的典型用法代码示例。如果您正苦于以下问题:Golang Housing.Filter方法的具体用法?Golang Housing.Filter怎么用?Golang Housing.Filter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/juju/juju/cmd/jujud/agent/util.Housing
的用法示例。
在下文中一共展示了Housing.Filter方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: TestReplacesFilter
func (*HousingSuite) TestReplacesFilter(c *gc.C) {
expectIn := errors.New("tweedledum")
expectOut := errors.New("tweedledee")
manifold := util.Housing{
Filter: func(in error) error {
c.Check(in, gc.Equals, expectIn)
return expectOut
},
}.Decorate(dependency.Manifold{
Filter: panicFilter,
})
out := manifold.Filter(expectIn)
c.Check(out, gc.Equals, expectOut)
}
示例2: TestEmptyHousingPopulatedManifold
func (*HousingSuite) TestEmptyHousingPopulatedManifold(c *gc.C) {
manifold := util.Housing{}.Decorate(dependency.Manifold{
Inputs: []string{"x", "y", "z"},
Start: panicStart,
Output: panicOutput,
Filter: panicFilter,
})
c.Check(manifold.Inputs, jc.DeepEquals, []string{"x", "y", "z"})
c.Check(func() {
manifold.Start(nil)
}, gc.PanicMatches, "panicStart")
c.Check(func() {
manifold.Output(nil, nil)
}, gc.PanicMatches, "panicOutput")
c.Check(func() {
manifold.Filter(nil)
}, gc.PanicMatches, "panicFilter")
}