本文整理汇总了Golang中net/http/httptest.Server.Format方法的典型用法代码示例。如果您正苦于以下问题:Golang Server.Format方法的具体用法?Golang Server.Format怎么用?Golang Server.Format使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net/http/httptest.Server
的用法示例。
在下文中一共展示了Server.Format方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1:
c := clients[0]
Expect(c["address"]).To(Equal(ts.URL))
})
It("gets datapoints", func() {
ts := time.Now()
g.SaveDataPoint("kitchen temperature", quimby.DataPoint{Time: ts, Value: 23.2})
time.Sleep(10 * time.Millisecond)
ts2 := time.Now()
g.SaveDataPoint("kitchen temperature", quimby.DataPoint{Time: ts2, Value: 23.4})
points, err := g.GetDataPoints("kitchen temperature", ts, ts2, 0, false)
Expect(err).To(BeNil())
Expect(len(points)).To(Equal(2))
p1 := points[0]
Expect(p1.Time.Format(time.RFC3339)).To(Equal(ts.Format(time.RFC3339)))
Expect(p1.Value).To(Equal(23.2))
p2 := points[1]
Expect(p2.Time.Format(time.RFC3339)).To(Equal(ts2.Format(time.RFC3339)))
Expect(p2.Value).To(Equal(23.4))
})
It("gets binary datapoints", func() {
ts := time.Now()
g.SaveDataPoint("kitchen temperature", quimby.DataPoint{Time: ts, Value: 0.0})
time.Sleep(10 * time.Millisecond)
ts2 := time.Now()
g.SaveDataPoint("kitchen temperature", quimby.DataPoint{Time: ts2, Value: 1.0})
points, err := g.GetDataPoints("kitchen temperature", ts, ts2, 0, true)
Expect(err).To(BeNil())