Example #1
0
func (s *UtilSuite) TestCloseAndLogNoError(c *gc.C) {
	closer := &filetesting.StubCloser{Stub: s.stub.Stub}
	logger := &stubLogger{Stub: s.stub.Stub}

	internal.CloseAndLog(closer, "a thing", logger)

	s.stub.CheckCallNames(c, "Close")
}
Example #2
0
func (s *UtilSuite) TestCloseAndLog(c *gc.C) {
	closer := &filetesting.StubCloser{Stub: s.stub.Stub}
	logger := &stubLogger{Stub: s.stub.Stub}
	failure := errors.New("<failure>")
	s.stub.SetErrors(failure)

	internal.CloseAndLog(closer, "a thing", logger)

	s.stub.CheckCallNames(c, "Close", "Errorf")
	c.Check(logger.logged, gc.Equals, "while closing a thing: <failure>")
}
Example #3
0
func (deps contextDeps) CloseAndLog(closer io.Closer, label string) {
	internal.CloseAndLog(closer, label, logger)
}