func (ts *TestSuite) TestShouldSortOnPublishedOn(c *C) { r, err := filerepo.New("test/sort") c.Assert(err, IsNil) latest, err := r.FindLatest(3) c.Assert(len(latest), Equals, 3) c.Assert(latest[0].Title, Equals, "C") c.Assert(latest[1].Title, Equals, "A") c.Assert(latest[2].Title, Equals, "B") }
func (ts *TestSuite) TestErrorsOnNoDirectory(c *C) { r, err := filerepo.New("test/nothing") c.Assert(r, IsNil) c.Assert(err, NotNil) }
import ( . "github.com/darkhelmet/blargh/errors" "github.com/darkhelmet/blargh/filerepo" . "launchpad.net/gocheck" "testing" "time" ) func Test(t *testing.T) { TestingT(t) } type TestSuite struct{} var ( _ = Suite(&TestSuite{}) good, _ = filerepo.New("test/repo") ) func (ts *TestSuite) TestNew(c *C) { r, err := filerepo.New("test/repo") c.Assert(r, NotNil) c.Assert(err, IsNil) } func (ts *TestSuite) TestErrorsOnNoDirectory(c *C) { r, err := filerepo.New("test/nothing") c.Assert(r, IsNil) c.Assert(err, NotNil) } func (ts *TestSuite) TestOnlyLoadPublished(c *C) {
func (ts *TestSuite) TestNew(c *C) { r, err := filerepo.New("test/repo") c.Assert(r, NotNil) c.Assert(err, IsNil) }
func NewFileRepo(dir string) (Repo, error) { return filerepo.New(dir) }