本文整理汇总了Golang中testing.T.Id方法的典型用法代码示例。如果您正苦于以下问题:Golang T.Id方法的具体用法?Golang T.Id怎么用?Golang T.Id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类testing.T
的用法示例。
在下文中一共展示了T.Id方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: TestGrammar
func TestGrammar(t *testing.T) {
bnf0 := GenerateBnf0Grammar()
g := GetIndexedGrammar(bnf0)
idxIf, err := g.GetIndex(GrammarIndexTypeTerm)
if err != nil {
t.Error(err)
return
}
termIndex := idxIf.(TermGrammarIndex)
for _, ntn := range termIndex.GetNonterminalNames() {
nt, _ := termIndex.GetNonterminal(ntn)
fmt.Printf("%d: <%s>\n", nt.Id(), nt.Name())
}
for _, tn := range termIndex.GetTerminalNames() {
t, _ := termIndex.GetTerminal(tn)
fmt.Printf("%d: %s\n", t.Id(), t.Name())
}
}
示例2: TestReachedFailureLimit
func TestReachedFailureLimit(t *testing.T) {
Convey("With 3 failed task and relevant project variants", t, func() {
db.Clear(task.Collection)
db.Clear(model.ProjectRefCollection)
db.Clear(version.Collection)
t := task.Task{
Id: "t1",
Revision: "aaa",
Project: "testProject",
BuildVariant: "bv1",
FinishTime: time.Now().Add(-time.Hour),
}
So(t.Insert(), ShouldBeNil)
t.Id = "t2"
t.BuildVariant = "bv2"
So(t.Insert(), ShouldBeNil)
t.Id = "t3"
t.BuildVariant = "bv3"
So(t.Insert(), ShouldBeNil)
So(testProject.Insert(), ShouldBeNil)
So(testVersion.Insert(), ShouldBeNil)
Convey("a variant with batchtime of 60 should not hit the limit", func() {
out, err := reachedFailureLimit("t1")
So(err, ShouldBeNil)
So(out, ShouldBeFalse)
})
Convey("a variant with batchtime of 1 should hit the limit", func() {
out, err := reachedFailureLimit("t2")
So(err, ShouldBeNil)
So(out, ShouldBeTrue)
})
Convey("a fallback batchtime of 5 should hit the limit", func() {
out, err := reachedFailureLimit("t3")
So(err, ShouldBeNil)
So(out, ShouldBeTrue)
})
})
}