From 74a38e66ed4256c47d6581878fb1789a1d890172 Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Tue, 3 Dec 2024 22:16:31 +0300 Subject: [PATCH] fix r4b liquid tests --- r4b/liquid/liquid-tests.json | 59 ++++++++++++++++++++++++++++++++++-- 1 file changed, 57 insertions(+), 2 deletions(-) diff --git a/r4b/liquid/liquid-tests.json b/r4b/liquid/liquid-tests.json index 4bcc6103..cd778212 100644 --- a/r4b/liquid/liquid-tests.json +++ b/r4b/liquid/liquid-tests.json @@ -30,13 +30,18 @@ },{ "name" : "prepend", "focus" : "Patient/example", - "template" : "{{Patient.id | prepend 'Patient-'}}", + "template" : "{{Patient.id || prepend: 'Patient-'}}", "output" : "Patient-example" },{ "name" : "if", "focus" : "Patient/example", "template" : "{% if Patient.id = 'example'%} yes {%else%} no {%endif%}", "output" : " yes " + },{ + "name" : "elsif", + "focus" : "Patient/example", + "template" : "{% if Patient.id = 'example'%} yes {%elsif Patient.id='none'%} ?? {%else%} no {%endif%}", + "output" : " yes " },{ "name" : "loop", "focus" : "Patient/example", @@ -49,6 +54,56 @@ "output" : "ChalmersWindsor", "includes" : { "humanname.html" : "{{include.name.family}}" - } + } + },{ + "name" : "for", + "focus" : "Patient/example", + "template" : "{%for name in Patient.name%}{{name.family}}{%endfor%} ", + "output" : "ChalmersWindsor " + },{ + "name" : "forelse", + "focus" : "Patient/example", + "template" : "{%for link in Patient.link%}{{link.type}}{%else%}none{%endfor%}", + "output" : "none" + },{ + "name" : "forcontinue", + "focus" : "Patient/example", + "template" : "{%for telecom in Patient.telecom%}{%if telecom.use = 'old'%}{%continue%}{%else%}{{telecom.value}}{%endif%}{%endfor%}", + "output" : "(03) 5555 6473(03) 3410 5613" + },{ + "name" : "forbreak", + "focus" : "Patient/example", + "template" : "{%for telecom in Patient.telecom%}{%if telecom.rank = 2%}{%break%}{%else%}{{telecom.value}}{%endif%}{%endfor%}", + "output" : "(03) 5555 6473" + },{ + "name" : "forcycle", + "focus" : "Patient/example", + "template" : "{%for telecom in Patient.telecom%}{%cycle \"odd\", \"even\"%}{%endfor%}", + "output" : "oddevenoddeven" + },{ + "name" : "forlimit", + "focus" : "Patient/example", + "template" : "{%for telecom in Patient.telecom limit:2%}{{telecom.use}}{%endfor%}", + "output" : "homework" + },{ + "name" : "foroffset", + "focus" : "Patient/example", + "template" : "{%for telecom in Patient.telecom offset:2%}{{telecom.use}}{%endfor%}", + "output" : "mobileold" + },{ + "name" : "forreversed", + "focus" : "Patient/example", + "template" : "{%for telecom in Patient.telecom reversed%}{{telecom.use}}{%endfor%}", + "output" : "oldmobileworkhome" + },{ + "name" : "assign1", + "focus" : "Patient/example", + "template" : "{% assign foo = \"bar\" %}{{ foo }}", + "output" : "bar" + },{ + "name" : "assign2", + "focus" : "Patient/example", + "template" : "{% assign my_variable = false %}{% if my_variable != true %}This statement is valid.{% endif %}", + "output" : "This statement is valid." }] }