예제 #1
0
파일: oplog_test.go 프로젝트: bac/juju
func (s *fakeSession) checkLastArgs(c *gc.C, ts bson.MongoTimestamp, ids []int64) {
	select {
	case <-time.After(coretesting.LongWait):
		c.Logf("timeout getting iter args - test problem")
		c.FailNow()
	case res := <-s.args:
		c.Check(res.timestamp, gc.Equals, ts)
		c.Check(res.excludeIds, gc.DeepEquals, ids)
	}
}
예제 #2
0
파일: runner.go 프로젝트: imoapps/juju
func (r *StubRunner) checkCallIDs(c *gc.C, methName string, skipMismatch bool, expected []string) {
	var ids []string
	for _, call := range r.Stub.Calls() {
		if !r.validMethodName(call.FuncName) {
			c.Logf("invalid called func name %q (must be one of %#v)", call.FuncName, runnerMethodNames)
			c.FailNow()
		}
		if methName != "" {
			if skipMismatch && call.FuncName != methName {
				continue
			}
			c.Check(call.FuncName, gc.Equals, methName)
		}
		ids = append(ids, call.Args[0].(string))
	}
	sort.Strings(ids)
	sort.Strings(expected)
	c.Check(ids, jc.DeepEquals, expected)
}
예제 #3
0
파일: util_test.go 프로젝트: petabi/pkgsrc
func (s *Suite) Test_isEmptyDir_and_getSubdirs(c *check.C) {
	s.CreateTmpFile(c, "CVS/Entries", "dummy\n")

	c.Check(isEmptyDir(s.tmpdir), equals, true)
	c.Check(getSubdirs(s.tmpdir), check.DeepEquals, []string(nil))

	s.CreateTmpFile(c, "somedir/file", "")

	c.Check(isEmptyDir(s.tmpdir), equals, false)
	c.Check(getSubdirs(s.tmpdir), check.DeepEquals, []string{"somedir"})

	if nodir := s.tmpdir + "/nonexistent"; true {
		c.Check(isEmptyDir(nodir), equals, true) // Counts as empty.
		defer s.ExpectFatalError(func() {
			c.Check(s.Output(), check.Matches, `FATAL: (.+): Cannot be read: open (.+): (.+)\n`)
		})
		c.Check(getSubdirs(nodir), check.DeepEquals, []string(nil))
		c.FailNow()
	}
}