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


Golang C.ExpectFailure方法代码示例

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


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

示例1: TestCheckCallNamesMissingCall

func (s *stubSuite) TestCheckCallNamesMissingCall(c *gc.C) {
	s.stub.AddCall("first", "arg")
	s.stub.AddCall("third")

	c.ExpectFailure(`the "standard" Stub.CheckCallNames call should fail here`)
	s.stub.CheckCallNames(c, "first", "second", "third")
}
开发者ID:fabricematrat,项目名称:testing,代码行数:7,代码来源:stub_test.go

示例2: TestCheckNoCalls

func (s *stubSuite) TestCheckNoCalls(c *gc.C) {
	s.stub.CheckNoCalls(c)

	s.stub.AddCall("method", "arg")
	c.ExpectFailure(`the "standard" Stub.CheckNoCalls call should fail here`)
	s.stub.CheckNoCalls(c)
}
开发者ID:juju,项目名称:testing,代码行数:7,代码来源:stub_test.go

示例3: TestMigrateAll

func (*migrateSuite) TestMigrateAll(c *gc.C) {
	c.ExpectFailure("all bundles do not migrate successfully")
	passed, total := 0, 0
	doAllBundles(c, func(c *gc.C, id string, data []byte) {
		c.Logf("\nmigrate test %s", id)
		ok := true
		bundles, err := Migrate(data, func(id *charm.Reference) (bool, error) {
			meta, err := getCharm(id)
			if err != nil {
				return false, err
			}
			return meta.Meta().Subordinate, nil
		})
		if err != nil {
			c.Logf("cannot migrate: %v", err)
			ok = false
		}
		for _, bundle := range bundles {
			ok = checkBundleData(c, bundle) && ok
		}
		if ok {
			passed++
		}
		total++
	})
	c.Logf("%d/%d passed", passed, total)
	c.Check(passed, gc.Equals, total)
}
开发者ID:jrwren,项目名称:charmrepo,代码行数:28,代码来源:migrate_test.go

示例4: TestEntriesCreateFailure

func (s *EntrySuite) TestEntriesCreateFailure(c *gc.C) {
	c.ExpectFailure("cannot create an entry")
	ft.Entries{
		ft.File{"good", "good", 0750},
		ft.File{"nodir/bad", "bad", 0640},
	}.Create(c, s.basePath)
}
开发者ID:fabricematrat,项目名称:testing,代码行数:7,代码来源:filetesting_test.go

示例5: TestRemovedCreateFailure

func (s *EntrySuite) TestRemovedCreateFailure(c *gc.C) {
	ft.File{"some-file", "content", 0644}.Create(c, s.basePath)
	os.Chmod(s.basePath, 0444)
	defer os.Chmod(s.basePath, 0777)
	c.ExpectFailure("should fail to remove file")
	ft.Removed{"some-file"}.Create(c, s.basePath)
}
开发者ID:fabricematrat,项目名称:testing,代码行数:7,代码来源:filetesting_test.go

示例6: TestCheckCallMissingCall

func (s *stubSuite) TestCheckCallMissingCall(c *gc.C) {
	s.stub.AddCall("first", "arg")
	s.stub.AddCall("third")

	c.ExpectFailure(`the "standard" Stub.CheckCall call should fail here`)
	s.checkCallStandard(c)
}
开发者ID:fabricematrat,项目名称:testing,代码行数:7,代码来源:stub_test.go

示例7: TestCheckCallNamesUnexpected

func (s *stubSuite) TestCheckCallNamesUnexpected(c *gc.C) {
	s.stub.AddCall("first", "arg")
	s.stub.AddCall("second", 1, 2, 4)
	s.stub.AddCall("third")

	c.ExpectFailure(`Stub.CheckCall should fail when no calls have been made`)
	s.stub.CheckCallNames(c)
}
开发者ID:fabricematrat,项目名称:testing,代码行数:8,代码来源:stub_test.go

示例8: TestCheckCallWrongArgs

func (s *stubSuite) TestCheckCallWrongArgs(c *gc.C) {
	s.stub.AddCall("first", "arg")
	s.stub.AddCall("second", 1, 2, 4)
	s.stub.AddCall("third")

	c.ExpectFailure(`the "standard" Stub.CheckCall call should fail here`)
	s.checkCallStandard(c)
}
开发者ID:fabricematrat,项目名称:testing,代码行数:8,代码来源:stub_test.go

示例9: TestEntriesCheckFailure

func (s *EntrySuite) TestEntriesCheckFailure(c *gc.C) {
	goodFile := ft.File{"good", "good", 0751}.Create(c, s.basePath)
	c.ExpectFailure("entry does not exist")
	ft.Entries{
		goodFile,
		ft.File{"bad", "", 0750},
	}.Check(c, s.basePath)
}
开发者ID:fabricematrat,项目名称:testing,代码行数:8,代码来源:filetesting_test.go

示例10: TestCheckCallsWrongName

func (s *stubSuite) TestCheckCallsWrongName(c *gc.C) {
	s.stub.AddCall("first", "arg")
	s.stub.AddCall("oops", 1, 2, 3)
	s.stub.AddCall("third")

	c.ExpectFailure(`the "standard" Stub.CheckCalls call should fail`)
	s.checkCallsStandard(c)
}
开发者ID:fabricematrat,项目名称:testing,代码行数:8,代码来源:stub_test.go

示例11: TestFileCheckFailureNoExist

func (s *EntrySuite) TestFileCheckFailureNoExist(c *gc.C) {
	c.ExpectFailure("shouldn't find file that does not exist")
	ft.File{"furble", "pingle", 0740}.Check(c, s.basePath)
}
开发者ID:fabricematrat,项目名称:testing,代码行数:4,代码来源:filetesting_test.go

示例12: TestFileCheckFailureBadData

func (s *EntrySuite) TestFileCheckFailureBadData(c *gc.C) {
	ft.File{"furble", "pingle", 0740}.Check(c, s.basePath)
	c.ExpectFailure("shouldn't pass with different content")
	ft.File{"furble", "wrongle", 0740}.Check(c, s.basePath)
}
开发者ID:fabricematrat,项目名称:testing,代码行数:5,代码来源:filetesting_test.go

示例13: TestFileCheckFailureBadPerm

func (s *EntrySuite) TestFileCheckFailureBadPerm(c *gc.C) {
	ft.File{"furble", "pingle", 0644}.Create(c, s.basePath)
	c.ExpectFailure("shouldn't pass with different perms")
	ft.File{"furble", "pingle", 0740}.Check(c, s.basePath)
}
开发者ID:fabricematrat,项目名称:testing,代码行数:5,代码来源:filetesting_test.go

示例14: TestFileCreateFailure

func (s *EntrySuite) TestFileCreateFailure(c *gc.C) {
	c.ExpectFailure("should fail to create file in missing dir")
	ft.File{"missing/foobar", "hello", 0644}.Create(c, s.basePath)
}
开发者ID:fabricematrat,项目名称:testing,代码行数:4,代码来源:filetesting_test.go

示例15: TestSymlinkCheckFailureNoExist

func (s *EntrySuite) TestSymlinkCheckFailureNoExist(c *gc.C) {
	c.ExpectFailure("should not accept symlink that doesn't exist")
	ft.Symlink{"link", "target"}.Check(c, s.basePath)
}
开发者ID:fabricematrat,项目名称:testing,代码行数:4,代码来源:filetesting_test.go


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