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

Golang contract.NewPackageResult函数代码示例

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

本文整理汇总了Golang中github.com/smartystreets/goconvey/web/server/contract.NewPackageResult函数的典型用法代码示例。如果您正苦于以下问题:Golang NewPackageResult函数的具体用法?Golang NewPackageResult怎么用?Golang NewPackageResult使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了NewPackageResult函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: TestParser

func TestParser(t *testing.T) {
	var (
		parser   *Parser
		packages = []*contract.Package{
			&contract.Package{Active: true, Output: "Active!", Result: contract.NewPackageResult("asdf")},
			&contract.Package{Active: false, Output: "Inactive!", Result: contract.NewPackageResult("qwer")},
		}
	)

	Convey("Subject: Parser parses test output for active packages", t, func() {
		parser = NewParser(fakeParserImplementation)

		Convey("When given a collection of packages", func() {
			parser.Parse(packages)

			Convey("The parser uses its internal parsing mechanism to parse the output of only the active packages", func() {
				So(packages[0].Result.Outcome, ShouldEqual, packages[0].Output)
			})

			Convey("The parser should mark inactive packages as ignored", func() {
				So(packages[1].Result.Outcome, ShouldEqual, contract.Ignored)
			})
		})
	})
}
开发者ID:npadmana,项目名称:goconvey,代码行数:25,代码来源:parser_test.go


示例2: TestParser

func TestParser(t *testing.T) {

	Convey("Subject: Parser parses test output for active packages", t, func() {
		packages := []*contract.Package{
			&contract.Package{Ignored: false, Output: "Active", Result: contract.NewPackageResult("asdf")},
			&contract.Package{Ignored: true, Output: "Inactive", Result: contract.NewPackageResult("qwer")},
		}
		parser := NewParser(fakeParserImplementation)

		Convey("When given a collection of packages", func() {
			parser.Parse(packages)

			Convey("The parser uses its internal parsing mechanism to parse the output of only the active packages", func() {
				So(packages[0].Result.Outcome, ShouldEqual, packages[0].Output)
			})

			Convey("The parser should mark inactive packages as ignored", func() {
				So(packages[1].Result.Outcome, ShouldEqual, contract.Ignored)
			})
		})

		Convey("When a package could not be tested (maybe it was deleted between scanning and execution?)", func() {
			packages[0].Output = ""
			packages[0].Error = errors.New("Directory does not exist")

			parser.Parse(packages)

			Convey("The package result should not be parsed and the outcome should actually resemble the problem", func() {
				So(packages[0].Result.Outcome, ShouldEqual, contract.TestRunAbortedUnexpectedly)
			})
		})
	})
}
开发者ID:FihlaTV,项目名称:bridge-server,代码行数:33,代码来源:parser_test.go


示例3: WatchedFolders

func (self *Watcher) WatchedFolders() []*contract.Package {
	i, watched := 0, make([]*contract.Package, len(self.watched))
	log.Println("Number of watched folders:", len(self.watched))
	for _, item := range self.watched {
		watched[i] = &contract.Package{
			Active: item.Active,
			Path:   item.Path,
			Name:   item.Name,
			Result: contract.NewPackageResult(item.Name),
		}
		i++
	}
	return watched
}
开发者ID:newobject,项目名称:goconvey,代码行数:14,代码来源:watcher.go


示例4: pointToExistingRootWithNestedFolders

func (self *watcherFixture) pointToExistingRootWithNestedFolders() (actual, expected interface{}) {
	self.files.Create(goProject, 1, time.Now())
	self.files.Create(goProject+normalize("/sub"), 2, time.Now())
	self.files.Create(goProject+normalize("/sub2"), 3, time.Now())
	self.files.Create(goProject+normalize("/sub/subsub"), 4, time.Now())

	self.watcher.Adjust(goProject)

	actual = self.watched()
	expected = []*contract.Package{
		&contract.Package{
			Active: true,
			Path:   goProject,
			Name:   goPackagePrefix,
			Result: contract.NewPackageResult(goPackagePrefix),
		},
		&contract.Package{
			Active: true,
			Path:   goProject + normalize("/sub"),
			Name:   goPackagePrefix + normalize("/sub"),
			Result: contract.NewPackageResult(goPackagePrefix + normalize("/sub")),
		},
		&contract.Package{
			Active: true,
			Path:   goProject + normalize("/sub/subsub"),
			Name:   goPackagePrefix + normalize("/sub/subsub"),
			Result: contract.NewPackageResult(goPackagePrefix + normalize("/sub/subsub")),
		},
		&contract.Package{
			Active: true,
			Path:   goProject + normalize("/sub2"),
			Name:   goPackagePrefix + normalize("/sub2"),
			Result: contract.NewPackageResult(goPackagePrefix + normalize("/sub2")),
		},
	}
	return
}
开发者ID:himanshugpt,项目名称:evergreen,代码行数:37,代码来源:watcher_test.go


示例5: reinstateIgnoredFolder

func (self *watcherFixture) reinstateIgnoredFolder() (actual, expected interface{}) {
	self.files.Create(goProject, 1, time.Now())
	self.files.Create(goProject+"/sub", 2, time.Now())
	self.watcher.Adjust(goProject)
	self.watcher.Ignore(goPackagePrefix + "/sub")

	self.watcher.Reinstate(goProject + "/sub")

	actual = self.watched()
	expected = []*contract.Package{
		&contract.Package{Active: true, Path: goProject, Name: goPackagePrefix, Result: contract.NewPackageResult(goPackagePrefix)},
		&contract.Package{Active: true, Path: goProject + "/sub", Name: goPackagePrefix + "/sub", Result: contract.NewPackageResult(goPackagePrefix + "/sub")},
	}
	return
}
开发者ID:devsaurin,项目名称:mongo-tools,代码行数:15,代码来源:watcher_test.go


示例6: pointToExistingRoot

func (self *watcherFixture) pointToExistingRoot(folder string) (actual, expected interface{}) {
	self.files.Create(folder, 1, time.Now())

	self.watcher.Adjust(folder)

	actual = self.watched()
	expected = []*contract.Package{
		&contract.Package{
			Active: true,
			Path:   goProject,
			Name:   goPackagePrefix,
			Result: contract.NewPackageResult(goPackagePrefix),
		},
	}
	return
}
开发者ID:himanshugpt,项目名称:evergreen,代码行数:16,代码来源:watcher_test.go


示例7: reinstateIrrelevantFolder

func (self *watcherFixture) reinstateIrrelevantFolder() (actual, expected interface{}) {
	self.files.Create(goProject, 1, time.Now())
	self.files.Create(normalize("/irrelevant"), 2, time.Now())
	self.watcher.Adjust(goProject)

	self.watcher.Reinstate(normalize("/irrelevant"))

	actual = self.watched()
	expected = []*contract.Package{
		&contract.Package{
			Active: true,
			Path:   goProject,
			Name:   goPackagePrefix,
			Result: contract.NewPackageResult(goPackagePrefix),
		},
	}
	return
}
开发者ID:himanshugpt,项目名称:evergreen,代码行数:18,代码来源:watcher_test.go


示例8: reinstateIgnoredFolders

func (self *watcherFixture) reinstateIgnoredFolders() (actual, expected interface{}) {
	self.files.Create(goProject, 1, time.Now())
	self.files.Create(goProject+normalize("/sub"), 2, time.Now())
	self.files.Create(goProject+normalize("/sub2"), 3, time.Now())
	self.files.Create(goProject+normalize("/sub3"), 4, time.Now())
	self.watcher.Adjust(goProject)
	self.watcher.Ignore(goPackagePrefix + normalize("/sub;") + goPackagePrefix + normalize("/sub2;") + goPackagePrefix + normalize("/sub3"))

	self.watcher.Reinstate(goProject + normalize("/sub;") + goPackagePrefix + normalize("/sub3"))

	actual = self.watched()
	expected = []*contract.Package{
		&contract.Package{Active: true, Path: goProject, Name: goPackagePrefix, Result: contract.NewPackageResult(goPackagePrefix)},
		&contract.Package{Active: true, Path: goProject + normalize("/sub"), Name: goPackagePrefix + normalize("/sub"), Result: contract.NewPackageResult(goPackagePrefix + normalize("/sub"))},
		&contract.Package{Active: false, Path: goProject + normalize("/sub2"), Name: goPackagePrefix + normalize("/sub2"), Result: contract.NewPackageResult(goPackagePrefix + normalize("/sub2"))},
		&contract.Package{Active: true, Path: goProject + normalize("/sub3"), Name: goPackagePrefix + normalize("/sub3"), Result: contract.NewPackageResult(goPackagePrefix + normalize("/sub3"))},
	}
	return
}
开发者ID:himanshugpt,项目名称:evergreen,代码行数:19,代码来源:watcher_test.go


示例9: WatchedFolders

func (self *Watcher) WatchedFolders() []*contract.Package {
	log.Println("Number of watched folders:", len(self.watched))

	paths := []string{}
	for _, item := range self.watched {
		paths = append(paths, item.Path)
	}
	sort.Strings(paths)

	watched := make([]*contract.Package, len(self.watched))
	for i, path := range paths {
		item := self.watched[path]
		watched[i] = &contract.Package{
			Active: item.Active,
			Path:   item.Path,
			Name:   item.Name,
			Result: contract.NewPackageResult(item.Name),
		}
	}
	return watched
}
开发者ID:himanshugpt,项目名称:evergreen,代码行数:21,代码来源:watcher.go


示例10: ignoreImaginaryFolder

func (self *watcherFixture) ignoreImaginaryFolder() (actual, expected interface{}) {
	self.files.Create(goProject, 1, time.Now())
	self.watcher.Adjust(goProject)

	self.watcher.Ignore("/not/there")

	actual = self.watched()
	expected = []*contract.Package{&contract.Package{Active: true, Path: goProject, Name: goPackagePrefix, Result: contract.NewPackageResult(goPackagePrefix)}}
	return
}
开发者ID:devsaurin,项目名称:mongo-tools,代码行数:10,代码来源:watcher_test.go


示例11: ignoreWatchedFolders

func (self *watcherFixture) ignoreWatchedFolders() (actual, expected interface{}) {
	self.watcher.Creation(goProject + "/sub2")
	self.watcher.Creation(goProject + "/sub3")
	self.watcher.Creation(goProject + "/sub4")

	self.watcher.Ignore(goPackagePrefix + "/sub2;" + goPackagePrefix + "/sub4")

	actual = self.watched()
	expected = []*contract.Package{
		&contract.Package{Active: false, Path: goProject + "/sub2", Name: goPackagePrefix + "/sub2", Result: contract.NewPackageResult(goPackagePrefix + "/sub2")},
		&contract.Package{Active: true, Path: goProject + "/sub3", Name: goPackagePrefix + "/sub3", Result: contract.NewPackageResult(goPackagePrefix + "/sub3")},
		&contract.Package{Active: false, Path: goProject + "/sub4", Name: goPackagePrefix + "/sub4", Result: contract.NewPackageResult(goPackagePrefix + "/sub4")},
	}
	return
}
开发者ID:devsaurin,项目名称:mongo-tools,代码行数:15,代码来源:watcher_test.go


示例12: receiveNotificationOfDeletedFolder

func (self *watcherFixture) receiveNotificationOfDeletedFolder() (actual, expected interface{}) {
	self.watcher.Creation(goProject + "/sub2")
	self.watcher.Creation(goProject + "/sub")

	self.watcher.Deletion(goProject + "/sub")

	actual = self.watched()
	expected = []*contract.Package{&contract.Package{Active: true, Path: goProject + "/sub2", Name: goPackagePrefix + "/sub2", Result: contract.NewPackageResult(goPackagePrefix + "/sub2")}}
	return
}
开发者ID:devsaurin,项目名称:mongo-tools,代码行数:10,代码来源:watcher_test.go


示例13: ignoreWatchedFolder

func (self *watcherFixture) ignoreWatchedFolder() (actual, expected interface{}) {
	self.watcher.Creation(goProject + normalize("/sub2"))

	self.watcher.Ignore(goPackagePrefix + normalize("/sub2"))

	actual = self.watched()
	expected = []*contract.Package{&contract.Package{Active: false, Path: goProject + normalize("/sub2"), Name: goPackagePrefix + normalize("/sub2"), Result: contract.NewPackageResult(goPackagePrefix + normalize("/sub2"))}}
	return
}
开发者ID:himanshugpt,项目名称:evergreen,代码行数:9,代码来源:watcher_test.go



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Golang contract.Executor类代码示例发布时间:2022-05-28
下一篇:
Golang convey.So函数代码示例发布时间: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