test: hemar: fix parse tests according code cahnges
This commit is contained in:
@@ -29,7 +29,7 @@ BEGIN;
|
|||||||
$$ LANGUAGE plpgsql;
|
$$ LANGUAGE plpgsql;
|
||||||
|
|
||||||
\ir test_jsonb_path.sql
|
\ir test_jsonb_path.sql
|
||||||
-- \ir test_template_parser.sql
|
\ir test_template_parser.sql
|
||||||
\ir test_render_exec.sql
|
\ir test_render_exec.sql
|
||||||
\ir test_render_interpolate.sql
|
\ir test_render_interpolate.sql
|
||||||
\ir test_render_section.sql
|
\ir test_render_section.sql
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ BEGIN
|
|||||||
IF NOT passed THEN
|
IF NOT passed THEN
|
||||||
RAISE WARNING 'Template parsing test failed!';
|
RAISE WARNING 'Template parsing test failed!';
|
||||||
RAISE WARNING 'Template: %', template_text;
|
RAISE WARNING 'Template: %', template_text;
|
||||||
|
-- RAISE WARNING 'Expected to find: %', pg_temp.test_regexp_replace(expected_structure);
|
||||||
|
-- RAISE WARNING 'Actual result: %', pg_temp.test_regexp_replace(parsed_result);
|
||||||
RAISE WARNING 'Expected to find: %', expected_structure;
|
RAISE WARNING 'Expected to find: %', expected_structure;
|
||||||
RAISE WARNING 'Actual result: %', parsed_result;
|
RAISE WARNING 'Actual result: %', parsed_result;
|
||||||
END IF;
|
END IF;
|
||||||
@@ -213,9 +215,9 @@ INTERPOLATE: "var3"$expected11$
|
|||||||
<p>{{ item.description }}</p>
|
<p>{{ item.description }}</p>
|
||||||
{{ include item.footer }}
|
{{ include item.footer }}
|
||||||
{{ end }}$hemar12$,
|
{{ end }}$hemar12$,
|
||||||
$expected12$SECTION: iterator="item", collection="items"
|
$expected12$Template parsed successfully. Structure:
|
||||||
TEXT: "
|
SECTION: iterator="item", collection="items"
|
||||||
<h2>"
|
TEXT: " <h2>"
|
||||||
INTERPOLATE: "item.title"
|
INTERPOLATE: "item.title"
|
||||||
TEXT: "</h2>
|
TEXT: "</h2>
|
||||||
<p>"
|
<p>"
|
||||||
@@ -224,7 +226,8 @@ INTERPOLATE: "var3"$expected11$
|
|||||||
"
|
"
|
||||||
INCLUDE: "item.footer"
|
INCLUDE: "item.footer"
|
||||||
TEXT: "
|
TEXT: "
|
||||||
"$expected12$
|
"
|
||||||
|
$expected12$
|
||||||
);
|
);
|
||||||
IF result THEN
|
IF result THEN
|
||||||
passed_tests := passed_tests + 1;
|
passed_tests := passed_tests + 1;
|
||||||
@@ -299,14 +302,13 @@ TEXT: "
|
|||||||
|
|
||||||
"
|
"
|
||||||
SECTION: iterator="item", collection="array"
|
SECTION: iterator="item", collection="array"
|
||||||
TEXT: "
|
TEXT: " some text: "
|
||||||
some text: "
|
|
||||||
INTERPOLATE: "name2"
|
INTERPOLATE: "name2"
|
||||||
TEXT: "
|
TEXT: "
|
||||||
"
|
"
|
||||||
INTERPOLATE: "item.name"
|
INTERPOLATE: "item.name"
|
||||||
TEXT: "
|
TEXT: "
|
||||||
"
|
"
|
||||||
TEXT: "
|
TEXT: "
|
||||||
|
|
||||||
<div>code insertion:</div>
|
<div>code insertion:</div>
|
||||||
@@ -340,18 +342,21 @@ TEXT: "
|
|||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}',
|
{{ end }}',
|
||||||
'SECTION: iterator="a", collection="items"
|
'Template parsed successfully. Structure:
|
||||||
TEXT: "
|
SECTION: iterator="a", collection="items"
|
||||||
"
|
TEXT: " "
|
||||||
SECTION: iterator="b", collection="a.items"
|
SECTION: iterator="b", collection="a.items"
|
||||||
TEXT: "
|
TEXT: " "
|
||||||
"
|
|
||||||
SECTION: iterator="c", collection="b.items"
|
SECTION: iterator="c", collection="b.items"
|
||||||
TEXT: "
|
TEXT: " "
|
||||||
"
|
|
||||||
INTERPOLATE: "c.name"
|
INTERPOLATE: "c.name"
|
||||||
TEXT: "
|
TEXT: "
|
||||||
"'
|
"
|
||||||
|
TEXT: "
|
||||||
|
"
|
||||||
|
TEXT: "
|
||||||
|
"
|
||||||
|
'
|
||||||
);
|
);
|
||||||
IF result THEN
|
IF result THEN
|
||||||
passed_tests := passed_tests + 1;
|
passed_tests := passed_tests + 1;
|
||||||
@@ -456,37 +461,34 @@ TEXT: "
|
|||||||
{{ end }}$template22$,
|
{{ end }}$template22$,
|
||||||
$expected22$Template parsed successfully. Structure:
|
$expected22$Template parsed successfully. Structure:
|
||||||
SECTION: iterator="x", collection="outer"
|
SECTION: iterator="x", collection="outer"
|
||||||
TEXT: "
|
TEXT: " Level 1: "
|
||||||
Level 1: "
|
|
||||||
INTERPOLATE: "x.name"
|
INTERPOLATE: "x.name"
|
||||||
TEXT: "
|
TEXT: "
|
||||||
"
|
"
|
||||||
SECTION: iterator="y", collection="x.items"
|
SECTION: iterator="y", collection="x.items"
|
||||||
TEXT: "
|
TEXT: " Level 2: "
|
||||||
Level 2: "
|
|
||||||
INTERPOLATE: "y.title"
|
INTERPOLATE: "y.title"
|
||||||
TEXT: "
|
TEXT: "
|
||||||
"
|
"
|
||||||
SECTION: iterator="z", collection="y.subitems"
|
SECTION: iterator="z", collection="y.subitems"
|
||||||
TEXT: "
|
TEXT: " Level 3: "
|
||||||
Level 3: "
|
|
||||||
INTERPOLATE: "z.label"
|
INTERPOLATE: "z.label"
|
||||||
TEXT: " - "
|
TEXT: " - "
|
||||||
INTERPOLATE: "z.value"
|
INTERPOLATE: "z.value"
|
||||||
TEXT: "
|
TEXT: "
|
||||||
"
|
"
|
||||||
SECTION: iterator="detail", collection="z.details"
|
SECTION: iterator="detail", collection="z.details"
|
||||||
TEXT: "
|
TEXT: " Details: "
|
||||||
Details: "
|
|
||||||
INTERPOLATE: "detail"
|
INTERPOLATE: "detail"
|
||||||
TEXT: "
|
TEXT: "
|
||||||
"
|
"
|
||||||
TEXT: "
|
TEXT: "
|
||||||
"
|
"
|
||||||
TEXT: "
|
TEXT: "
|
||||||
"
|
"
|
||||||
TEXT: "
|
TEXT: "
|
||||||
"$expected22$
|
"
|
||||||
|
$expected22$
|
||||||
);
|
);
|
||||||
IF result THEN
|
IF result THEN
|
||||||
passed_tests := passed_tests + 1;
|
passed_tests := passed_tests + 1;
|
||||||
@@ -518,13 +520,12 @@ TEXT: "</header>
|
|||||||
<nav>
|
<nav>
|
||||||
"
|
"
|
||||||
SECTION: iterator="item", collection="menu_items"
|
SECTION: iterator="item", collection="menu_items"
|
||||||
TEXT: "
|
TEXT: " <a href=""
|
||||||
<a href=""
|
|
||||||
INTERPOLATE: "item.url"
|
INTERPOLATE: "item.url"
|
||||||
TEXT: "">"
|
TEXT: "">"
|
||||||
INTERPOLATE: "item.label"
|
INTERPOLATE: "item.label"
|
||||||
TEXT: "</a>
|
TEXT: "</a>
|
||||||
"
|
"
|
||||||
TEXT: "
|
TEXT: "
|
||||||
</nav>
|
</nav>
|
||||||
<main>
|
<main>
|
||||||
@@ -535,7 +536,8 @@ TEXT: "
|
|||||||
EXECUTE: "SELECT get_footer_text() AS footer_text;"
|
EXECUTE: "SELECT get_footer_text() AS footer_text;"
|
||||||
TEXT: "
|
TEXT: "
|
||||||
</main>
|
</main>
|
||||||
</div>"$expected23$
|
</div>"
|
||||||
|
$expected23$
|
||||||
);
|
);
|
||||||
IF result THEN
|
IF result THEN
|
||||||
passed_tests := passed_tests + 1;
|
passed_tests := passed_tests + 1;
|
||||||
@@ -626,12 +628,13 @@ INCLUDE: "system.templates[user.template_index]"$expected27$
|
|||||||
$template29${{ for item in items }}
|
$template29${{ for item in items }}
|
||||||
{{ item.name }}
|
{{ item.name }}
|
||||||
{{ end }}$template29$,
|
{{ end }}$template29$,
|
||||||
$expected29$SECTION: iterator="item", collection="items"
|
$expected29$Template parsed successfully. Structure:
|
||||||
TEXT: "
|
SECTION: iterator="item", collection="items"
|
||||||
"
|
TEXT: " "
|
||||||
INTERPOLATE: "item.name"
|
INTERPOLATE: "item.name"
|
||||||
TEXT: "
|
TEXT: "
|
||||||
"$expected29$
|
"
|
||||||
|
$expected29$
|
||||||
);
|
);
|
||||||
IF result THEN
|
IF result THEN
|
||||||
passed_tests := passed_tests + 1;
|
passed_tests := passed_tests + 1;
|
||||||
@@ -693,14 +696,14 @@ END;"$expected30$
|
|||||||
<span>{{ item.name }}</span>
|
<span>{{ item.name }}</span>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</div>$template31$,
|
</div>$template31$,
|
||||||
$expected31$TEXT: "<div>
|
$expected31$Template parsed successfully. Structure:
|
||||||
|
TEXT: "<div>
|
||||||
"
|
"
|
||||||
SECTION: iterator="item", collection="items"
|
SECTION: iterator="item", collection="items"
|
||||||
TEXT: "
|
TEXT: " <span>"
|
||||||
<span>"
|
|
||||||
INTERPOLATE: "item.name"
|
INTERPOLATE: "item.name"
|
||||||
TEXT: "</span>
|
TEXT: "</span>
|
||||||
"
|
"
|
||||||
TEXT: "
|
TEXT: "
|
||||||
</div>"$expected31$
|
</div>"$expected31$
|
||||||
);
|
);
|
||||||
@@ -762,18 +765,19 @@ ORDER BY level, name;"$expected32$
|
|||||||
{{ for template_name in available_templates }}
|
{{ for template_name in available_templates }}
|
||||||
{{ include template_name }}
|
{{ include template_name }}
|
||||||
{{ end }}$template33$,
|
{{ end }}$template33$,
|
||||||
$expected33$INCLUDE: "base_template"
|
$expected33$Template parsed successfully. Structure:
|
||||||
|
INCLUDE: "base_template"
|
||||||
TEXT: "
|
TEXT: "
|
||||||
"
|
"
|
||||||
INCLUDE: "dynamic_templates[index]"
|
INCLUDE: "dynamic_templates[index]"
|
||||||
TEXT: "
|
TEXT: "
|
||||||
"
|
"
|
||||||
SECTION: iterator="template_name", collection="available_templates"
|
SECTION: iterator="template_name", collection="available_templates"
|
||||||
TEXT: "
|
TEXT: " "
|
||||||
"
|
|
||||||
INCLUDE: "template_name"
|
INCLUDE: "template_name"
|
||||||
TEXT: "
|
TEXT: "
|
||||||
"$expected33$
|
"
|
||||||
|
$expected33$
|
||||||
);
|
);
|
||||||
IF result THEN
|
IF result THEN
|
||||||
passed_tests := passed_tests + 1;
|
passed_tests := passed_tests + 1;
|
||||||
@@ -912,32 +916,31 @@ END;"$expected37$
|
|||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}$template38$,
|
{{ end }}$template38$,
|
||||||
$expected38$SECTION: iterator="user", collection="users"
|
$expected38$Template parsed successfully. Structure:
|
||||||
TEXT: "
|
SECTION: iterator="user", collection="users"
|
||||||
"
|
TEXT: " "
|
||||||
INTERPOLATE: "user.name"
|
INTERPOLATE: "user.name"
|
||||||
TEXT: "'s permissions:
|
TEXT: "'s permissions:
|
||||||
"
|
"
|
||||||
SECTION: iterator="permission", collection="user.permissions"
|
SECTION: iterator="permission", collection="user.permissions"
|
||||||
TEXT: "
|
TEXT: " - "
|
||||||
- "
|
|
||||||
INTERPOLATE: "permission.name"
|
INTERPOLATE: "permission.name"
|
||||||
TEXT: ": "
|
TEXT: ": "
|
||||||
INTERPOLATE: "permission.status"
|
INTERPOLATE: "permission.status"
|
||||||
TEXT: "
|
TEXT: "
|
||||||
"
|
"
|
||||||
SECTION: iterator="scope", collection="permission.scopes"
|
SECTION: iterator="scope", collection="permission.scopes"
|
||||||
TEXT: "
|
TEXT: " * "
|
||||||
* "
|
|
||||||
INTERPOLATE: "scope.area"
|
INTERPOLATE: "scope.area"
|
||||||
TEXT: ": "
|
TEXT: ": "
|
||||||
INTERPOLATE: "scope.level"
|
INTERPOLATE: "scope.level"
|
||||||
TEXT: "
|
TEXT: "
|
||||||
"
|
"
|
||||||
TEXT: "
|
TEXT: "
|
||||||
"
|
"
|
||||||
TEXT: "
|
TEXT: "
|
||||||
"$expected38$
|
"
|
||||||
|
$expected38$
|
||||||
);
|
);
|
||||||
IF result THEN
|
IF result THEN
|
||||||
passed_tests := passed_tests + 1;
|
passed_tests := passed_tests + 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user