Skip to content

Commit

Permalink
chore(tests): add a test for block control structure multiple reusing…
Browse files Browse the repository at this point in the history
… of self
  • Loading branch information
NikolaLohinski committed May 11, 2024
1 parent e6a8c10 commit 8f46b62
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions tests/integration/control_structure_block_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,36 @@ var _ = Context("control structure 'block'", func() {
AssertPrettyDiff(expected, *returnedResult)
})
})
Context("when reusing the self block multiple times", func() {
BeforeEach(func() {
*loader = loaders.MustNewMemoryLoader(map[string]string{
*identifier: heredoc.Doc(`
{% block block -%}
reused content
{%- endblock block %}
some content in between
{{ self.block() }}
{{ self.block() }}
`),
})
})

It("should return the expected rendered content", func() {
By("not returning any error")
Expect(*returnedErr).To(BeNil())
By("returning the expected result")
expected := heredoc.Doc(`
reused content
some content in between
reused content
reused content
`)
AssertPrettyDiff(expected, *returnedResult)
})
})

})

0 comments on commit 8f46b62

Please sign in to comment.