File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -21,6 +21,11 @@ func NewEngine() *Engine {
2121 return & e
2222}
2323
24+ // NewBasicEngine returns a new Engine without the standard filters or tags.
25+ func NewBasicEngine () * Engine {
26+ return & Engine {render .NewConfig ()}
27+ }
28+
2429// RegisterBlock defines a block e.g. {% tag %}…{% endtag %}.
2530func (e * Engine ) RegisterBlock (name string , td Renderer ) {
2631 e .cfg .AddBlock (name ).Renderer (func (w io.Writer , ctx render.Context ) error {
Original file line number Diff line number Diff line change @@ -40,6 +40,25 @@ func TestEngine_ParseAndRenderString(t *testing.T) {
4040 }
4141}
4242
43+ func TestBasicEngine_ParseAndRenderString (t * testing.T ) {
44+ engine := NewBasicEngine ()
45+
46+ t .Run ("1" , func (t * testing.T ) {
47+ test := liquidTests [0 ]
48+ out , err := engine .ParseAndRenderString (test .in , testBindings )
49+ require .NoErrorf (t , err , test .in )
50+ require .Equalf (t , test .expected , out , test .in )
51+ })
52+
53+ for i , test := range liquidTests [1 :] {
54+ t .Run (strconv .Itoa (i + 2 ), func (t * testing.T ) {
55+ out , err := engine .ParseAndRenderString (test .in , testBindings )
56+ require .Errorf (t , err , test .in )
57+ require .Equalf (t , "" , out , test .in )
58+ })
59+ }
60+ }
61+
4362type capWriter struct {
4463 bytes.Buffer
4564}
You can’t perform that action at this time.
0 commit comments