當前位置: 首頁>>代碼示例>>Golang>>正文


Golang C.ExpectFailure方法代碼示例

本文整理匯總了Golang中launchpad/net/gocheck.C.ExpectFailure方法的典型用法代碼示例。如果您正苦於以下問題:Golang C.ExpectFailure方法的具體用法?Golang C.ExpectFailure怎麽用?Golang C.ExpectFailure使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在launchpad/net/gocheck.C的用法示例。


在下文中一共展示了C.ExpectFailure方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: 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:jimmiebtlr,項目名稱:testing,代碼行數:7,代碼來源:filetesting_test.go

示例2: 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:jimmiebtlr,項目名稱:testing,代碼行數:7,代碼來源:filetesting_test.go

示例3: 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:jimmiebtlr,項目名稱:testing,代碼行數:8,代碼來源:filetesting_test.go

示例4: TestDebugLogAtUUIDLogPath

func (s *clientSuite) TestDebugLogAtUUIDLogPath(c *gc.C) {
	s.PatchValue(api.WebsocketDialConfig, echoURL(c))
	// If the server supports it, we should log at "/environment/UUID/log"
	environ, err := s.State.Environment()
	c.Assert(err, gc.IsNil)
	info := s.APIInfo(c)
	info.EnvironTag = environ.Tag()
	apistate, err := api.Open(info, api.DialOpts{})
	c.Assert(err, gc.IsNil)
	defer apistate.Close()
	reader, err := apistate.Client().WatchDebugLog(api.DebugLogParams{})
	c.Assert(err, gc.IsNil)
	connectURL := connectURLFromReader(c, reader)
	c.ExpectFailure("debug log always goes to /log for compatibility http://pad.lv/1326799")
	c.Assert(connectURL.Path, gc.Matches, fmt.Sprintf("/%s/log", environ.UUID()))
}
開發者ID:zhouqt,項目名稱:juju,代碼行數:16,代碼來源:client_test.go

示例5: 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:jimmiebtlr,項目名稱:testing,代碼行數:5,代碼來源:filetesting_test.go

示例6: 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:jimmiebtlr,項目名稱:testing,代碼行數:5,代碼來源:filetesting_test.go

示例7: TestDirCheckFailureBadPerm

func (s *EntrySuite) TestDirCheckFailureBadPerm(c *gc.C) {
	ft.Dir{"furble", 0740}.Check(c, s.basePath)
	c.ExpectFailure("shouldn't pass with different perms")
	ft.Dir{"furble", 0755}.Check(c, s.basePath)
}
開發者ID:jimmiebtlr,項目名稱:testing,代碼行數:5,代碼來源:filetesting_test.go

示例8: 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:jimmiebtlr,項目名稱:testing,代碼行數:4,代碼來源:filetesting_test.go

示例9: TestRemovedCheckFailureSymlink

func (s *EntrySuite) TestRemovedCheckFailureSymlink(c *gc.C) {
	ft.Symlink{"some-link", "target"}.Create(c, s.basePath)
	c.ExpectFailure("should not accept symlink")
	ft.Removed{"some-link"}.Check(c, s.basePath)
}
開發者ID:jimmiebtlr,項目名稱:testing,代碼行數:5,代碼來源:filetesting_test.go

示例10: TestDirCheckFailureSymlink

func (s *EntrySuite) TestDirCheckFailureSymlink(c *gc.C) {
	ft.Symlink{"link", "dir"}.Create(c, s.basePath)
	ft.Dir{"dir", 0644}.Create(c, s.basePath)
	c.ExpectFailure("shouldn't accept symlink, even if pointing to matching dir")
	ft.Dir{"link", 0644}.Check(c, s.basePath)
}
開發者ID:jimmiebtlr,項目名稱:testing,代碼行數:6,代碼來源:filetesting_test.go

示例11: TestSucceed

func (s *ExpectFailureSucceedHelper) TestSucceed(c *gocheck.C) {
	c.ExpectFailure("It booms!")
	c.Error("Boom!")
}
開發者ID:evaluation-alex,項目名稱:gosync,代碼行數:4,代碼來源:foundation_test.go

示例12: TestSymlinkCreateFailure

func (s *EntrySuite) TestSymlinkCreateFailure(c *gc.C) {
	c.ExpectFailure("should fail to create symlink in missing dir")
	ft.Symlink{"missing/link", "target"}.Create(c, s.basePath)
}
開發者ID:jimmiebtlr,項目名稱:testing,代碼行數:4,代碼來源:filetesting_test.go

示例13: TestSymlinkCheckFailureDir

func (s *EntrySuite) TestSymlinkCheckFailureDir(c *gc.C) {
	ft.Dir{"link", 0755}.Create(c, s.basePath)
	c.ExpectFailure("should not accept dir")
	ft.Symlink{"link", "different"}.Check(c, s.basePath)
}
開發者ID:jimmiebtlr,項目名稱:testing,代碼行數:5,代碼來源:filetesting_test.go

示例14: TestFileCheckFailureDir

func (s *EntrySuite) TestFileCheckFailureDir(c *gc.C) {
	ft.Dir{"furble", 0740}.Create(c, s.basePath)
	c.ExpectFailure("shouldn't accept dir")
	ft.File{"furble", "pingle", 0740}.Check(c, s.basePath)
}
開發者ID:jimmiebtlr,項目名稱:testing,代碼行數:5,代碼來源:filetesting_test.go

示例15: TestSymlinkCheckFailureFile

func (s *EntrySuite) TestSymlinkCheckFailureFile(c *gc.C) {
	ft.File{"link", "target", 0644}.Create(c, s.basePath)
	c.ExpectFailure("should not accept plain file")
	ft.Symlink{"link", "target"}.Check(c, s.basePath)
}
開發者ID:jimmiebtlr,項目名稱:testing,代碼行數:5,代碼來源:filetesting_test.go


注:本文中的launchpad/net/gocheck.C.ExpectFailure方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。