2017-07-06 19:31:36 -04:00
|
|
|
package pages
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/osteele/gojekyll/config"
|
2017-07-08 19:57:41 -04:00
|
|
|
"github.com/osteele/liquid"
|
2017-07-06 19:31:36 -04:00
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestPage_ToLiquid(t *testing.T) {
|
|
|
|
cfg := config.Default()
|
2017-07-10 13:23:51 -04:00
|
|
|
page, err := NewFile(siteFake{t, cfg}, "testdata/excerpt.md", "excerpt.md", map[string]interface{}{})
|
2017-07-06 19:31:36 -04:00
|
|
|
require.NoError(t, err)
|
2017-07-08 19:57:41 -04:00
|
|
|
drop := page.(liquid.Drop).ToLiquid()
|
2017-07-06 19:31:36 -04:00
|
|
|
excerpt := drop.(map[string]interface{})["excerpt"]
|
|
|
|
// FIXME the following probably isn't right
|
|
|
|
// TODO also test post-rendering.
|
|
|
|
require.Equal(t, "First line.", excerpt)
|
|
|
|
}
|