本文整理汇总了Golang中github.com/orfjackal/nanospec/go/src/nanospec.Context.Assume方法的典型用法代码示例。如果您正苦于以下问题:Golang Context.Assume方法的具体用法?Golang Context.Assume怎么用?Golang Context.Assume使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/orfjackal/nanospec/go/src/nanospec.Context
的用法示例。
在下文中一共展示了Context.Assume方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: ExpectationsSpec
func ExpectationsSpec(c nanospec.Context) {
c.Specify("When a spec has passing expectations or assumptions", func() {
results := runSpec(func(c Context) {
c.Expect(1, Equals, 1)
c.Assume(1, Equals, 1)
c.Specify("Child", func() {})
})
c.Specify("then the spec passes", func() {
c.Expect(results.FailCount()).Equals(0)
})
c.Specify("then its children are executed", func() {
c.Expect(results.TotalCount()).Equals(2)
})
})
c.Specify("When a spec has failing expectations", func() {
results := runSpec(func(c Context) {
c.Expect(1, Equals, 2)
c.Specify("Child", func() {})
})
c.Specify("then the spec fails", func() {
c.Expect(results.FailCount()).Equals(1)
})
c.Specify("then its children are executed", func() {
c.Expect(results.TotalCount()).Equals(2)
})
})
c.Specify("When a spec has failing assumptions", func() {
results := runSpec(func(c Context) {
c.Assume(1, Equals, 2)
c.Specify("Child", func() {})
})
c.Specify("then the spec fails", func() {
c.Expect(results.FailCount()).Equals(1)
})
c.Specify("then its children are NOT executed", func() {
c.Expect(results.TotalCount()).Equals(1)
})
})
c.Specify("The location of a failed expectation is reported", func() {
results := runSpec(func(c Context) {
c.Expect(1, Equals, 2)
})
c.Expect(fileOfError(results)).Equals("expectations_test.go")
})
c.Specify("The location of a failed assumption is reported", func() {
results := runSpec(func(c Context) {
c.Assume(1, Equals, 2)
})
c.Expect(fileOfError(results)).Equals("expectations_test.go")
})
}