本文整理汇总了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")
}
示例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)
}
示例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)
}
示例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)
}
示例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)
}
示例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)
}
示例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)
}
示例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)
}
示例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)
}
示例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)
}
示例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)
}
示例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)
}
示例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)
}
示例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)
}
示例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)
}