本文整理汇总了Golang中github.com/twstrike/coyim/Godeps/_workspace/src/gopkg/in/check/v1.C类的典型用法代码示例。如果您正苦于以下问题:Golang C类的具体用法?Golang C怎么用?Golang C使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了C类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: Test_Peers_sortsByNameForPresentation
func (s *ListSuite) Test_Peers_sortsByNameForPresentation(c *g.C) {
expectedPeers := []*Peer{
&Peer{
Jid: "ba", Name: "ab",
},
&Peer{
Jid: "ac", Name: "",
},
&Peer{
Jid: "aa", Name: "bb",
},
&Peer{
Jid: "aa", Name: "cb",
},
}
group := &Group{
peers: []*Peer{
expectedPeers[2],
expectedPeers[0],
expectedPeers[3],
expectedPeers[1],
},
}
c.Assert(group.Peers(), g.DeepEquals, expectedPeers)
}
示例2: Test_LatestError_setsLatestErrorWhenExists
func (s *ListSuite) Test_LatestError_setsLatestErrorWhenExists(c *g.C) {
l := New()
pp := &Peer{Jid: "[email protected]"}
l.AddOrMerge(pp)
l.LatestError("[email protected]/foo", "tow", "frou", "sxi")
c.Assert(pp.LatestError, g.DeepEquals, &PeerError{"tow", "frou", "sxi"})
}
示例3: Test_Clear_clearsTheList
func (s *ListSuite) Test_Clear_clearsTheList(c *g.C) {
l := New()
l.AddOrMerge(&Peer{Jid: "[email protected]"})
l.Clear()
c.Assert(len(l.peers), g.Equals, 0)
}
示例4: Test_SetLatestError_setsLatestError
func (s *PeerXmppSuite) Test_SetLatestError_setsLatestError(c *g.C) {
p1 := &Peer{
Groups: toSet("one"),
resources: toSet(),
}
p1.SetLatestError("oen", "tow", "there")
c.Assert(p1.LatestError, g.DeepEquals, &PeerError{"oen", "tow", "there"})
}
示例5: Test_MergeWith_takesTheFirstGroupsIfExists
func (s *PeerXmppSuite) Test_MergeWith_takesTheFirstGroupsIfExists(c *g.C) {
p1 := &Peer{
Groups: toSet("one"),
resources: toSet(),
}
p2 := &Peer{}
c.Assert(fromSet(p1.MergeWith(p2).Groups)[0], g.Equals, "one")
}
示例6: Test_SubscribeRequest_addsTheSubscribeID
func (s *ListSuite) Test_SubscribeRequest_addsTheSubscribeID(c *g.C) {
l := New()
l.AddOrMerge(&Peer{Jid: "[email protected]"})
l.SubscribeRequest("[email protected]/hmm", "something", "")
c.Assert(l.peers["[email protected]"].PendingSubscribeID, g.Equals, "something")
l.SubscribeRequest("[email protected]/hmm2", "something3", "")
c.Assert(l.peers["[email protected]"].PendingSubscribeID, g.Equals, "something3")
}
示例7: Test_Dump_willDumpAllInfo
func (s *PeerXmppSuite) Test_Dump_willDumpAllInfo(c *g.C) {
p := &Peer{
Jid: "[email protected]",
Name: "something",
Subscription: "from",
Groups: toSet("hello::bar"),
resources: toSet(),
}
c.Assert(p.Dump(), g.Equals, "Peer{[email protected][something ()], subscription='from', status=''('') online=false, asked=false, pendingSubscribe='', belongsTo=''}")
}
示例8: assertLogContains
func assertLogContains(c *gocheck.C, ch <-chan interface{}, exp events.Log) {
logs := captureLogsEvents(ch)
for _, l := range logs {
if reflect.DeepEqual(l, exp) {
return
}
}
c.Errorf("Could not finr %#v in %#v", exp, logs)
}
示例9: Test_ToSlice_createsASliceOfTheContentSortedAlphabetically
func (s *ListSuite) Test_ToSlice_createsASliceOfTheContentSortedAlphabetically(c *g.C) {
l := New()
l.AddOrMerge(&Peer{Jid: "[email protected]"})
l.AddOrMerge(&Peer{Jid: "[email protected]"})
l.AddOrMerge(&Peer{Jid: "[email protected]"})
c.Assert(l.ToSlice(), g.DeepEquals, []*Peer{
&Peer{Jid: "[email protected]"},
&Peer{Jid: "[email protected]"},
&Peer{Jid: "[email protected]"},
})
}
示例10: Test_TopLevelGroup_returnsATopLevelGroup
func (s *GroupListSuite) Test_TopLevelGroup_returnsATopLevelGroup(c *g.C) {
result := TopLevelGroup()
c.Check(result.GroupName, g.Equals, "")
c.Check(result.fullGroupName, g.DeepEquals, []string{})
c.Check(result.peers, g.DeepEquals, []*Peer{})
c.Check(result.groups, g.DeepEquals, map[string]*Group{})
}
示例11: Test_PeerWithState_createsANewPeer
func (s *PeerXmppSuite) Test_PeerWithState_createsANewPeer(c *g.C) {
p := PeerWithState("[email protected]/1234", "hmm", "no", "", "")
c.Assert(p.Jid, g.Equals, "[email protected]")
c.Assert(p.Name, g.Equals, "")
c.Assert(p.Status, g.Equals, "hmm")
c.Assert(p.StatusMsg, g.Equals, "no")
}
示例12: Test_IterAll_willIterateOverAllTheListsGivenAndYieldTheirPeers
func (s *ListSuite) Test_IterAll_willIterateOverAllTheListsGivenAndYieldTheirPeers(c *g.C) {
l := New()
l2 := New()
pp := &Peer{Jid: "[email protected]"}
pp2 := &Peer{Jid: "[email protected]"}
l.AddOrMerge(pp)
l2.AddOrMerge(pp2)
result := []*Peer{}
IterAll(func(_ int, p *Peer) {
result = append(result, p)
}, l, l2)
c.Assert(result, g.DeepEquals, []*Peer{pp2, pp})
}
示例13: Test_GetPendingSubscribe_returnsThePendingSubscribeIfExists
func (s *ListSuite) Test_GetPendingSubscribe_returnsThePendingSubscribeIfExists(c *g.C) {
l := New()
l.AddOrMerge(&Peer{Jid: "[email protected]", PendingSubscribeID: "foo"})
l.AddOrMerge(&Peer{Jid: "[email protected]"})
v, k := l.GetPendingSubscribe("[email protected]")
c.Assert(k, g.Equals, false)
v, k = l.GetPendingSubscribe("[email protected]/bar")
c.Assert(k, g.Equals, true)
c.Assert(v, g.Equals, "foo")
v, k = l.GetPendingSubscribe("[email protected]/bar")
c.Assert(k, g.Equals, false)
c.Assert(v, g.Equals, "")
}
示例14: Test_Unsubscribed_whenExist
func (s *ListSuite) Test_Unsubscribed_whenExist(c *g.C) {
l := New()
l.AddOrMerge(&Peer{Jid: "[email protected]", Subscription: "both", Asked: true, PendingSubscribeID: "foo"})
l.AddOrMerge(&Peer{Jid: "[email protected]", Subscription: "to"})
l.AddOrMerge(&Peer{Jid: "[email protected]", Subscription: "from"})
l.Unsubscribed("[email protected]/123")
c.Assert(l.peers["[email protected]"].Subscription, g.Equals, "from")
c.Assert(l.peers["[email protected]"].Asked, g.Equals, false)
c.Assert(l.peers["[email protected]"].PendingSubscribeID, g.Equals, "")
l.Unsubscribed("[email protected]/123")
c.Assert(l.peers["[email protected]"].Subscription, g.Equals, "none")
l.Unsubscribed("[email protected]/123")
c.Assert(l.peers["[email protected]"].Subscription, g.Equals, "from")
}
示例15: Test_toEntry_ReturnsAnEntryWithTheInformation
func (s *PeerXmppSuite) Test_toEntry_ReturnsAnEntryWithTheInformation(c *g.C) {
p := &Peer{
Jid: "[email protected]",
Name: "something",
Subscription: "from",
Groups: toSet("hello::bar"),
resources: toSet(),
}
c.Assert(p.ToEntry().Jid, g.Equals, "[email protected]")
c.Assert(p.ToEntry().Name, g.Equals, "something")
c.Assert(p.ToEntry().Subscription, g.Equals, "from")
c.Assert(p.ToEntry().Group, g.DeepEquals, []string{"hello::bar"})
}