本文整理汇总了Golang中github.com/jackc/box.Time.SetEmpty方法的典型用法代码示例。如果您正苦于以下问题:Golang Time.SetEmpty方法的具体用法?Golang Time.SetEmpty怎么用?Golang Time.SetEmpty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/jackc/box.Time
的用法示例。
在下文中一共展示了Time.SetEmpty方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: TestMustGetPanicsWhenNotFull
func (s *MySuite) TestMustGetPanicsWhenNotFull(c *C) {
var b box.Time
b.SetUndefined()
c.Check(b.MustGet, Panics, "called MustGet on a box that was not full")
b.SetUnknown()
c.Check(b.MustGet, Panics, "called MustGet on a box that was not full")
b.SetEmpty()
c.Check(b.MustGet, Panics, "called MustGet on a box that was not full")
}
示例2: TestGetCoerceNil
func (s *MySuite) TestGetCoerceNil(c *C) {
var b box.Time
b.SetUndefined()
c.Check(b.GetCoerceNil(), Equals, nil)
b.SetUnknown()
c.Check(b.GetCoerceNil(), Equals, nil)
b.SetEmpty()
c.Check(b.GetCoerceNil(), Equals, nil)
val := time.Now()
b.Set(val)
c.Check(b.GetCoerceNil(), Equals, val)
}
示例3: TestSetAndGet
func (s *MySuite) TestSetAndGet(c *C) {
var b box.Time
val := time.Now()
b.Set(val)
val2, present := b.Get()
c.Check(val2, Equals, val)
c.Check(present, Equals, true)
c.Check(b.MustGet(), Equals, val)
b.SetUndefined()
_, present = b.Get()
c.Check(present, Equals, false)
b.SetUnknown()
_, present = b.Get()
c.Check(present, Equals, false)
b.SetEmpty()
_, present = b.Get()
c.Check(present, Equals, false)
}