本文整理汇总了Golang中github.com/jackc/box.Time类的典型用法代码示例。如果您正苦于以下问题:Golang Time类的具体用法?Golang Time怎么用?Golang Time使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Time类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: TestSetCoerceZero
func (s *MySuite) TestSetCoerceZero(c *C) {
var b box.Time
var zero time.Time
b.SetCoerceZero(zero, box.Empty)
c.Check(b.Status(), Equals, byte(box.Empty))
}
示例2: TestSetCoerceNil
func (s *MySuite) TestSetCoerceNil(c *C) {
var b box.Time
b.SetCoerceNil(nil, box.Empty)
c.Check(b.Status(), Equals, byte(box.Empty))
}
示例3: 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")
}
示例4: TestGetCoerceZero
func (s *MySuite) TestGetCoerceZero(c *C) {
var b box.Time
var zero time.Time
b.SetUndefined()
c.Check(b.GetCoerceZero(), Equals, zero)
b.SetUnknown()
c.Check(b.GetCoerceZero(), Equals, zero)
b.SetEmpty()
c.Check(b.GetCoerceZero(), Equals, zero)
val := time.Now()
b.Set(val)
c.Check(b.GetCoerceNil(), Equals, val)
}
示例5: 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)
}
示例6: TestZeroValueTimeIsUndefined
func (s *MySuite) TestZeroValueTimeIsUndefined(c *C) {
var b box.Time
c.Check(b.Status(), Equals, byte(box.Undefined))
}