本文整理汇总了Golang中launchpad/net/gocheck.Run函数的典型用法代码示例。如果您正苦于以下问题:Golang Run函数的具体用法?Golang Run怎么用?Golang Run使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Run函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: TestExpectFailureSucceed
func (s *FoundationS) TestExpectFailureSucceed(c *gocheck.C) {
helper := ExpectFailureSucceedHelper{}
output := String{}
result := gocheck.Run(&helper, &gocheck.RunConf{Output: &output})
c.Assert(output.value, gocheck.Equals, "")
c.Assert(result.ExpectedFailures, gocheck.Equals, 1)
}
示例2: TestSkip
func (s *FoundationS) TestSkip(c *gocheck.C) {
helper := SkipTestHelper{}
output := String{}
gocheck.Run(&helper, &gocheck.RunConf{Output: &output})
if output.value != "" {
c.Error("Skip() logged something:\n", output.value)
}
}
示例3: TestRunDoesntShowSuccesses
func (s *BootstrapS) TestRunDoesntShowSuccesses(c *gocheck.C) {
output := String{}
gocheck.Run(&SuccessHelper{}, &gocheck.RunConf{Output: &output})
if strings.Index(output.value, "Expected success!") != -1 {
critical(fmt.Sprintf("RunWithWriter() output contained a successful "+
"test! Got: %#v",
output.value))
}
}
示例4: TestRunShowsErrors
func (s *BootstrapS) TestRunShowsErrors(c *gocheck.C) {
output := String{}
gocheck.Run(&FailHelper{}, &gocheck.RunConf{Output: &output})
if strings.Index(output.value, "Expected failure!") == -1 {
critical(fmt.Sprintf("RunWithWriter() output did not contain the "+
"expected failure! Got: %#v",
output.value))
}
}
示例5: TestSkipVerbose
func (s *FoundationS) TestSkipVerbose(c *gocheck.C) {
helper := SkipTestHelper{}
output := String{}
gocheck.Run(&helper, &gocheck.RunConf{Output: &output, Verbose: true})
expected := "SKIP: foundation_test\\.go:[0-9]+: SkipTestHelper\\.TestFail" +
" \\(Wrong platform or whatever\\)"
matched, err := regexp.MatchString(expected, output.value)
if err != nil {
c.Error("Bad expression: ", expected)
} else if !matched {
c.Error("Skip() didn't log properly:\n", output.value)
}
}
示例6: TestMkDir
func (s *HelpersS) TestMkDir(c *gocheck.C) {
helper := MkDirHelper{}
output := String{}
gocheck.Run(&helper, &gocheck.RunConf{Output: &output})
c.Assert(output.value, gocheck.Equals, "")
c.Check(helper.isDir1, gocheck.Equals, true)
c.Check(helper.isDir2, gocheck.Equals, true)
c.Check(helper.isDir3, gocheck.Equals, true)
c.Check(helper.isDir4, gocheck.Equals, true)
c.Check(helper.path1, gocheck.Not(gocheck.Equals),
helper.path2)
c.Check(isDir(helper.path1), gocheck.Equals, false)
c.Check(isDir(helper.path2), gocheck.Equals, false)
}
示例7: TestFailureHeader
func (s *FoundationS) TestFailureHeader(c *gocheck.C) {
output := String{}
failHelper := FailHelper{}
gocheck.Run(&failHelper, &gocheck.RunConf{Output: &output})
header := fmt.Sprintf(""+
"\n-----------------------------------"+
"-----------------------------------\n"+
"FAIL: gocheck_test.go:%d: FailHelper.TestLogAndFail\n",
failHelper.testLine)
if strings.Index(output.value, header) == -1 {
c.Errorf(""+
"Failure didn't print a proper header.\n"+
"... Got:\n%s... Expected something with:\n%s",
output.value, header)
}
}
示例8: TestExpectFailureSucceedVerbose
func (s *FoundationS) TestExpectFailureSucceedVerbose(c *gocheck.C) {
helper := ExpectFailureSucceedHelper{}
output := String{}
result := gocheck.Run(&helper, &gocheck.RunConf{Output: &output, Verbose: true})
expected := "" +
"FAIL EXPECTED: foundation_test\\.go:[0-9]+:" +
" ExpectFailureSucceedHelper\\.TestSucceed \\(It booms!\\)\t *[.0-9]+s\n"
matched, err := regexp.MatchString(expected, output.value)
if err != nil {
c.Error("Bad expression: ", expected)
} else if !matched {
c.Error("ExpectFailure() didn't log properly:\n", output.value)
}
c.Assert(result.ExpectedFailures, gocheck.Equals, 1)
}
示例9: TestExpectFailureFail
func (s *FoundationS) TestExpectFailureFail(c *gocheck.C) {
helper := ExpectFailureFailHelper{}
output := String{}
result := gocheck.Run(&helper, &gocheck.RunConf{Output: &output})
expected := "" +
"^\n-+\n" +
"FAIL: foundation_test\\.go:[0-9]+:" +
" ExpectFailureFailHelper\\.TestFail\n\n" +
"\\.\\.\\. Error: Test succeeded, but was expected to fail\n" +
"\\.\\.\\. Reason: Bug #XYZ\n$"
matched, err := regexp.MatchString(expected, output.value)
if err != nil {
c.Error("Bad expression: ", expected)
} else if !matched {
c.Error("ExpectFailure() didn't log properly:\n", output.value)
}
c.Assert(result.ExpectedFailures, gocheck.Equals, 0)
}