当前位置: 首页>>代码示例>>Golang>>正文


Golang C.Succeed方法代码示例

本文整理汇总了Golang中launchpad/net/gocheck.C.Succeed方法的典型用法代码示例。如果您正苦于以下问题:Golang C.Succeed方法的具体用法?Golang C.Succeed怎么用?Golang C.Succeed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在launchpad/net/gocheck.C的用法示例。


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

示例1: TestFailedAndSucceed

func (s *BootstrapS) TestFailedAndSucceed(c *gocheck.C) {
	c.Fail()
	c.Succeed()
	if c.Failed() {
		critical("c.Succeed() didn't put the test back in a non-failed state")
	}
}
开发者ID:kelsieflynn,项目名称:gocheck,代码行数:7,代码来源:bootstrap_test.go

示例2: TestFailedAndFail

func (s *BootstrapS) TestFailedAndFail(c *gocheck.C) {
	if c.Failed() {
		critical("c.Failed() must be false first!")
	}
	c.Fail()
	if !c.Failed() {
		critical("c.Fail() didn't put the test in a failed state!")
	}
	c.Succeed()
}
开发者ID:kelsieflynn,项目名称:gocheck,代码行数:10,代码来源:bootstrap_test.go

示例3: TestFailNow

func (s *FoundationS) TestFailNow(c *gocheck.C) {
	defer (func() {
		if !c.Failed() {
			c.Error("FailNow() didn't fail the test")
		} else {
			c.Succeed()
			if c.GetTestLog() != "" {
				c.Error("Something got logged:\n" + c.GetTestLog())
			}
		}
	})()

	c.FailNow()
	c.Log("FailNow() didn't stop the test")
}
开发者ID:evaluation-alex,项目名称:gosync,代码行数:15,代码来源:foundation_test.go

示例4: SetUpSuite

func (s *S) SetUpSuite(c *gocheck.C) {
	go func() {
		http.Handle("/html.html", http.HandlerFunc(htmlHandler))
		http.Handle("/bin.bin", http.HandlerFunc(binHandler))
		http.Handle("/post", http.HandlerFunc(postHandler))
		http.Handle("/404.html", http.NotFoundHandler())
		http.Handle("/cookie.html", http.HandlerFunc(cookieHandler))
		http.Handle("/redirect/", http.HandlerFunc(redirectHandler))
		fmt.Printf("\nRunning test server on http://localhost:54123\n")
		if err := http.ListenAndServe(":54123", nil); err != nil {
			c.Fatalf("Cannot run test server on port: %s", err.String())
		}
	}()
	time.Sleep(2e8)
	c.Succeed()
}
开发者ID:vdobler,项目名称:webtest,代码行数:16,代码来源:suite_test.go

示例5: TestErrorf

func (s *FoundationS) TestErrorf(c *gocheck.C) {
	// Do not use checkState() here.  It depends on Errorf() working.
	expectedLog := fmt.Sprintf("foundation_test.go:%d:\n"+
		"    c.Errorf(\"Error %%v!\", \"message\")\n"+
		"... Error: Error message!\n\n",
		getMyLine()+1)
	c.Errorf("Error %v!", "message")
	failed := c.Failed()
	c.Succeed()
	if log := c.GetTestLog(); log != expectedLog {
		c.Logf("Errorf() logged %#v rather than %#v", log, expectedLog)
		c.Fail()
	}
	if !failed {
		c.Logf("Errorf() didn't put the test in a failed state")
		c.Fail()
	}
}
开发者ID:evaluation-alex,项目名称:gosync,代码行数:18,代码来源:foundation_test.go

示例6: TestFatalf

func (s *FoundationS) TestFatalf(c *gocheck.C) {
	var line int
	defer (func() {
		if !c.Failed() {
			c.Error("Fatalf() didn't fail the test")
		} else {
			c.Succeed()
			expected := fmt.Sprintf("foundation_test.go:%d:\n"+
				"    c.Fatalf(\"Die %%s!\", \"now\")\n"+
				"... Error: Die now!\n\n",
				line)
			if c.GetTestLog() != expected {
				c.Error("Incorrect log:", c.GetTestLog())
			}
		}
	})()

	line = getMyLine() + 1
	c.Fatalf("Die %s!", "now")
	c.Log("Fatalf() didn't stop the test")
}
开发者ID:evaluation-alex,项目名称:gosync,代码行数:21,代码来源:foundation_test.go

示例7: assertEnvironPorts

// assertEnvironPorts retrieves the open ports of environment and compares them
// to the expected.
func (s *FirewallerSuite) assertEnvironPorts(c *gc.C, expected []network.Port) {
	s.BackingState.StartSync()
	start := time.Now()
	for {
		got, err := s.Environ.Ports()
		if err != nil {
			c.Fatal(err)
			return
		}
		network.SortPorts(got)
		network.SortPorts(expected)
		if reflect.DeepEqual(got, expected) {
			c.Succeed()
			return
		}
		if time.Since(start) > coretesting.LongWait {
			c.Fatalf("timed out: expected %q; got %q", expected, got)
			return
		}
		time.Sleep(coretesting.ShortWait)
	}
}
开发者ID:jiasir,项目名称:juju,代码行数:24,代码来源:firewaller_test.go

示例8: assertPorts

// assertPorts retrieves the open ports of the instance and compares them
// to the expected.
func (s *FirewallerSuite) assertPorts(c *gc.C, inst instance.Instance, machineId string, expected []instance.Port) {
	s.BackingState.StartSync()
	start := time.Now()
	for {
		got, err := inst.Ports(machineId)
		if err != nil {
			c.Fatal(err)
			return
		}
		instance.SortPorts(got)
		instance.SortPorts(expected)
		if reflect.DeepEqual(got, expected) {
			c.Succeed()
			return
		}
		if time.Since(start) > coretesting.LongWait {
			c.Fatalf("timed out: expected %q; got %q", expected, got)
			return
		}
		time.Sleep(coretesting.ShortWait)
	}
}
开发者ID:jkary,项目名称:core,代码行数:24,代码来源:firewaller_test.go

示例9: checkState

// Verify the state of the test.  Note that since this also verifies if
// the test is supposed to be in a failed state, no other checks should
// be done in addition to what is being tested.
func checkState(c *gocheck.C, result interface{}, expected *expectedState) {
	failed := c.Failed()
	c.Succeed()
	log := c.GetTestLog()
	matched, matchError := regexp.MatchString("^"+expected.log+"$", log)
	if matchError != nil {
		c.Errorf("Error in matching expression used in testing %s",
			expected.name)
	} else if !matched {
		c.Errorf("%s logged %#v which doesn't match %#v",
			expected.name, log, expected.log)
	}
	if result != expected.result {
		c.Errorf("%s returned %#v rather than %#v",
			expected.name, result, expected.result)
	}
	if failed != expected.failed {
		if failed {
			c.Errorf("%s has failed when it shouldn't", expected.name)
		} else {
			c.Errorf("%s has not failed when it should", expected.name)
		}
	}
}
开发者ID:CloudMarc,项目名称:mgo,代码行数:27,代码来源:gocheck_test.go


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