From bedf4de0dec9d88b7387b3e7071d934753abcfdf Mon Sep 17 00:00:00 2001 From: fefit Date: Sun, 24 Oct 2021 10:32:01 +0800 Subject: [PATCH] tests: add more tests for fet --- codecov.yml | 3 +++ fet_test.go | 2 ++ tests/smarty/templates/extends.tpl | 1 + tests/smarty/templates/extends_override.tpl | 2 ++ tests/smarty/templates/inc/base.tpl | 3 +++ 5 files changed, 11 insertions(+) create mode 100644 codecov.yml create mode 100644 tests/smarty/templates/extends.tpl create mode 100644 tests/smarty/templates/extends_override.tpl diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 0000000..9cba933 --- /dev/null +++ b/codecov.yml @@ -0,0 +1,3 @@ +ignore: + - types/types.go + - lib/generator/generator.go \ No newline at end of file diff --git a/fet_test.go b/fet_test.go index 7d3e6cc..7d839f9 100644 --- a/fet_test.go +++ b/fet_test.go @@ -55,5 +55,7 @@ func TestCompile(t *testing.T) { "Footer": "fet", }, "header:hello;footer:fet") assertOutputToBe(t, "include_props.tpl", nil, "header:hello;footer:fet") + assertOutputToBe(t, "extends.tpl", nil, "(header)\n(content)\n(footer)") + assertOutputToBe(t, "extends_override.tpl", nil, "(override:header)\n(content)\n(footer)") }) } diff --git a/tests/smarty/templates/extends.tpl b/tests/smarty/templates/extends.tpl new file mode 100644 index 0000000..77a9a9b --- /dev/null +++ b/tests/smarty/templates/extends.tpl @@ -0,0 +1 @@ +{%extends file="inc/base.tpl"%} \ No newline at end of file diff --git a/tests/smarty/templates/extends_override.tpl b/tests/smarty/templates/extends_override.tpl new file mode 100644 index 0000000..e10c34e --- /dev/null +++ b/tests/smarty/templates/extends_override.tpl @@ -0,0 +1,2 @@ +{%extends "inc/base.tpl"%} +{%block name="header"%}(override:header){%/block%} \ No newline at end of file diff --git a/tests/smarty/templates/inc/base.tpl b/tests/smarty/templates/inc/base.tpl index e69de29..12723f6 100644 --- a/tests/smarty/templates/inc/base.tpl +++ b/tests/smarty/templates/inc/base.tpl @@ -0,0 +1,3 @@ +{%block "header"%}(header){%/block%} +{%block "content"%}(content){%/block%} +{%block "footer"%}(footer){%/block%} \ No newline at end of file