Skip to content

Commit

Permalink
tests: add more tests cases
Browse files Browse the repository at this point in the history
  • Loading branch information
fefit committed Oct 24, 2021
1 parent cec5da5 commit d14f565
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 0 deletions.
7 changes: 7 additions & 0 deletions fet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ func TestCompile(t *testing.T) {
Mode: types.Smarty,
TemplateDir: "tests/smarty/templates",
CompileDir: "tests/smarty/views",
Ignores: []string{"tests/smarty/templates/inc"},
LeftDelimiter: "{%",
RightDelimiter: "%}",
UcaseField: true,
Expand Down Expand Up @@ -48,5 +49,11 @@ func TestCompile(t *testing.T) {
assertOutputToBe(t, "minmax.tpl", nil, "1,2")
assertOutputToBe(t, "mod.tpl", nil, "1.15")
assertOutputToBe(t, "pipe.tpl", nil, "2021-09-05 18:07:06")
assertOutputToBe(t, "comment.tpl", nil, "")
assertOutputToBe(t, "include.tpl", map[string]string{
"Header": "hello",
"Footer": "fet",
}, "header:hello;footer:fet")
assertOutputToBe(t, "include_props.tpl", nil, "header:hello;footer:fet")
})
}
4 changes: 4 additions & 0 deletions tests/smarty/templates/comment.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{%*
* this is a comment
* all comments will removed after compile
*%}
Empty file.
1 change: 1 addition & 0 deletions tests/smarty/templates/inc/footer.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
footer:{%$footer%}
1 change: 1 addition & 0 deletions tests/smarty/templates/inc/header.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
header:{%$header%}
1 change: 1 addition & 0 deletions tests/smarty/templates/include.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{%include "inc/header.tpl"%};{%include file="inc/footer.tpl"%}
1 change: 1 addition & 0 deletions tests/smarty/templates/include_props.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{%include header="hello" "inc/header.tpl"%};{%include file="inc/footer.tpl" footer="fet"%}

0 comments on commit d14f565

Please sign in to comment.