Beispiel #1
0
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")
}
Beispiel #2
0
func (ts *TestSuite) TestErrorsOnNoDirectory(c *C) {
	r, err := filerepo.New("test/nothing")
	c.Assert(r, IsNil)
	c.Assert(err, NotNil)
}
Beispiel #3
0
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) {
Beispiel #4
0
func (ts *TestSuite) TestNew(c *C) {
	r, err := filerepo.New("test/repo")
	c.Assert(r, NotNil)
	c.Assert(err, IsNil)
}
Beispiel #5
0
func NewFileRepo(dir string) (Repo, error) {
	return filerepo.New(dir)
}