package plugins import ( "regexp" "testing" "github.com/osteele/gojekyll/config" "github.com/osteele/gojekyll/pages" "github.com/osteele/liquid" "github.com/stretchr/testify/require" ) type siteFake struct { c config.Config e *liquid.Engine } func (s siteFake) AddDocument(pages.Document, bool) {} func (s siteFake) Config() *config.Config { return &s.c } func (s siteFake) HasLayout(string) bool { return true } func (s siteFake) Pages() []pages.Page { return nil } func (s siteFake) Posts() []pages.Page { return nil } func (s siteFake) TemplateEngine() *liquid.Engine { return s.e } func TestAvatarTag(t *testing.T) { engine := liquid.NewEngine() plugins := []string{"jekyll-avatar"} _ = Install(plugins, siteFake{config.Default(), engine}) require.NoError(t, directory[plugins[0]].ConfigureTemplateEngine(engine)) bindings := liquid.Bindings{"user": "osteele"} s, err := engine.ParseAndRenderString(`{% avatar osteele %}`, bindings) require.NoError(t, err) re := regexp.MustCompile(`