当前位置: 首页>>代码示例>>Golang>>正文


Golang box.Time类代码示例

本文整理汇总了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))
}
开发者ID:jackc,项目名称:box,代码行数:7,代码来源:box_test.go

示例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))
}
开发者ID:jackc,项目名称:box,代码行数:7,代码来源:box_test.go

示例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")
}
开发者ID:jackc,项目名称:box,代码行数:12,代码来源:box_test.go

示例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)
}
开发者ID:jackc,项目名称:box,代码行数:17,代码来源:box_test.go

示例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)
}
开发者ID:jackc,项目名称:box,代码行数:24,代码来源:box_test.go

示例6: TestZeroValueTimeIsUndefined

func (s *MySuite) TestZeroValueTimeIsUndefined(c *C) {
	var b box.Time
	c.Check(b.Status(), Equals, byte(box.Undefined))
}
开发者ID:jackc,项目名称:box,代码行数:4,代码来源:box_test.go


注:本文中的github.com/jackc/box.Time类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。