• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang v1.C类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/twstrike/coyim/Godeps/_workspace/src/gopkg/in/check/v1.C的典型用法代码示例。如果您正苦于以下问题:Golang C类的具体用法?Golang C怎么用?Golang C使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了C类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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)
}
开发者ID:rosatolen,项目名称:coyim,代码行数:27,代码来源:list_test.go


示例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"})
}
开发者ID:rosatolen,项目名称:coyim,代码行数:8,代码来源:list_test.go


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


示例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"})
}
开发者ID:rosatolen,项目名称:coyim,代码行数:9,代码来源:peer_test.go


示例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")
}
开发者ID:rosatolen,项目名称:coyim,代码行数:9,代码来源:peer_test.go


示例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")
}
开发者ID:rosatolen,项目名称:coyim,代码行数:10,代码来源:list_test.go


示例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=''}")
}
开发者ID:rosatolen,项目名称:coyim,代码行数:11,代码来源:peer_test.go


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


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


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


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


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


示例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, "")
}
开发者ID:rosatolen,项目名称:coyim,代码行数:16,代码来源:list_test.go


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


示例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"})
}
开发者ID:rosatolen,项目名称:coyim,代码行数:14,代码来源:peer_test.go


示例16: Test_AddOrMerge_addsTheEntryIfNotInTheList

func (s *ListSuite) Test_AddOrMerge_addsTheEntryIfNotInTheList(c *g.C) {
	l := New()
	p := &Peer{Jid: "somewhere", Name: "something"}

	res := l.AddOrMerge(p)

	c.Assert(res, g.Equals, true)
	c.Assert(len(l.peers), g.Equals, 1)
	c.Assert(l.peers["somewhere"], g.Equals, p)
}
开发者ID:rosatolen,项目名称:coyim,代码行数:10,代码来源:list_test.go


示例17: Test_Remove_doesNothingWhenAskedToRemoveEntryNotInList

func (s *ListSuite) Test_Remove_doesNothingWhenAskedToRemoveEntryNotInList(c *g.C) {
	l := New()
	l.peers["[email protected]"] = &Peer{}

	res, rem := l.Remove("[email protected]")

	c.Assert(rem, g.Equals, false)
	c.Assert(res, g.IsNil)
	c.Assert(len(l.peers), g.Equals, 1)
}
开发者ID:rosatolen,项目名称:coyim,代码行数:10,代码来源:list_test.go


示例18: Test_PeerFrom_returnsANewPeerWithTheSameInformation

func (s *PeerXmppSuite) Test_PeerFrom_returnsANewPeerWithTheSameInformation(c *g.C) {
	re := data.RosterEntry{
		Jid:          "[email protected]",
		Subscription: "from",
		Name:         "someone",
		Group: []string{
			"onegroup",
			"twogroup",
		},
	}

	p := PeerFrom(re, "", "", nil)

	c.Assert(p.Jid, g.Equals, "[email protected]")
	c.Assert(p.Subscription, g.Equals, "from")
	c.Assert(p.Name, g.Equals, "someone")
	c.Assert(p.Groups, g.DeepEquals, toSet("onegroup", "twogroup"))
}
开发者ID:rosatolen,项目名称:coyim,代码行数:18,代码来源:peer_test.go


示例19: Test_Remove_removesAnEntryIfInTheList

func (s *ListSuite) Test_Remove_removesAnEntryIfInTheList(c *g.C) {
	l := New()
	l.peers["[email protected]"] = &Peer{}
	l.peers["[email protected]"] = &Peer{Name: "me"}

	res, rem := l.Remove("[email protected]/somewhere")

	c.Assert(rem, g.Equals, true)
	c.Assert(res.Name, g.Equals, "me")
	c.Assert(len(l.peers), g.Equals, 1)
}
开发者ID:rosatolen,项目名称:coyim,代码行数:11,代码来源:list_test.go


示例20: Test_PeerBecameUnavailable_setsTheOfflineState

func (s *ListSuite) Test_PeerBecameUnavailable_setsTheOfflineState(c *g.C) {
	l := New()
	l.AddOrMerge(&Peer{Jid: "[email protected]", Online: true})

	res := l.PeerBecameUnavailable("[email protected]/foo")
	c.Assert(res, g.Equals, false)

	res = l.PeerBecameUnavailable("[email protected]/foo2")
	c.Assert(res, g.Equals, true)
	c.Assert(l.peers["[email protected]"].Online, g.Equals, false)
}
开发者ID:rosatolen,项目名称:coyim,代码行数:11,代码来源:list_test.go



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang i18n.InitLocalization函数代码示例发布时间:2022-05-28
下一篇:
Golang glib.ToGObject函数代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap