fix: hemar: parser
This commit is contained in:
@@ -4,6 +4,8 @@
|
||||
-- Load extension if not already loaded
|
||||
-- CREATE EXTENSION IF NOT EXISTS hemar;
|
||||
|
||||
-- SAFETY(yukkop): !!! If you fix identation, you will ruin the tests.
|
||||
|
||||
-- Create test function to validate template parsing
|
||||
CREATE OR REPLACE FUNCTION test_template_parse(template_text text, expected_structure text) RETURNS boolean AS $$
|
||||
DECLARE
|
||||
@@ -165,18 +167,8 @@ TEXT: "</div>"$expected8$
|
||||
-- Test 9: Execute tag with complex SQL
|
||||
total_tests := total_tests + 1;
|
||||
result := test_template_parse(
|
||||
$template9${{ exec
|
||||
IF condition THEN
|
||||
RETURN 'value1';
|
||||
ELSE
|
||||
RETURN 'value2';
|
||||
END IF;
|
||||
}}$template9$,
|
||||
$expected9$EXECUTE: "IF condition THEN
|
||||
RETURN 'value1';
|
||||
ELSE
|
||||
RETURN 'value2';
|
||||
END IF;"$expected9$
|
||||
'{{ exec SELECT 123 AS number; }}',
|
||||
'EXECUTE: "SELECT 123 AS number;"'
|
||||
);
|
||||
IF result THEN
|
||||
passed_tests := passed_tests + 1;
|
||||
@@ -282,7 +274,6 @@ INTERPOLATE: "var3"$expected11$
|
||||
{{ end }}
|
||||
|
||||
<div>code insertion:</div>
|
||||
// FIXME: IT NEED A SPECE PIZDEZZZZ
|
||||
{{ exec
|
||||
context + '{"name3": "zalupa"}';
|
||||
|
||||
@@ -295,7 +286,8 @@ INTERPOLATE: "var3"$expected11$
|
||||
}}
|
||||
|
||||
<div id="footer">...</div>$template15$,
|
||||
$expected15$TEXT: "<div>text before<div>
|
||||
$expected15$Template parsed successfully. Structure:
|
||||
TEXT: "<div>text before<div>
|
||||
|
||||
"
|
||||
INCLUDE: "inner_template"
|
||||
@@ -329,7 +321,7 @@ EXECUTE: "context + '{"name3": "zalupa"}';
|
||||
RETURN 'some other text';"
|
||||
TEXT: "
|
||||
|
||||
<div id=\"footer\">...</div>"$expected15$
|
||||
<div id="footer">...</div>"$expected15$
|
||||
);
|
||||
IF result THEN
|
||||
passed_tests := passed_tests + 1;
|
||||
|
||||
Reference in New Issue
Block a user