本文整理匯總了Golang中github.com/daaku/rell/internal/github.com/facebookgo/stack.Multi類的典型用法代碼示例。如果您正苦於以下問題:Golang Multi類的具體用法?Golang Multi怎麽用?Golang Multi使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Multi類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: TestMultiStackSingleStack
func TestMultiStackSingleStack(t *testing.T) {
frame := stack.Frame{Name: "42"}
s := stack.Stack{frame}
var multi stack.Multi
multi.Add(s)
ensure.DeepEqual(t, MultiStack(&singleStackError{stack: s}), &multi)
}
示例2: TestStackMultiStack
func TestStackMultiStack(t *testing.T) {
frame := stack.Frame{Name: "42"}
s := stack.Stack{frame}
var multi stack.Multi
multi.Add(s)
ensure.DeepEqual(t, Stack(&multiStackError{multiStack: &multi}), s)
}
示例3: MultiStack
// MultiStack returns the best possible stack.Multi from the error or nil if
// one isn't found.
func MultiStack(err error) *stack.Multi {
switch err := err.(type) {
case *singleFrameError:
var m stack.Multi
m.Add(stack.Stack{err.frame})
return &m
case *singleStackError:
var m stack.Multi
m.Add(err.stack)
return &m
case *multiStackError:
return err.multiStack
}
return nil
}
示例4: TestMultiStackStringModeNone
func TestMultiStackStringModeNone(t *testing.T) {
err := errors.New("foo")
var m stack.Multi
m.Add(stack.Stack{
stack.Frame{
File: "f",
Line: 1,
Name: "n",
},
})
ensure.DeepEqual(
t,
(&multiStackError{
underlying: err,
config: Config{},
multiStack: &m,
}).Error(),
`foo`)
}
示例5: TestMultiStackSingleFrame
func TestMultiStackSingleFrame(t *testing.T) {
frame := stack.Frame{Name: "42"}
var multi stack.Multi
multi.Add(stack.Stack{frame})
ensure.DeepEqual(t, MultiStack(&singleFrameError{frame: frame}), &multi)
}