Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Basic test cases for Tipi

  • Loading branch information...
commit 461dd0bae2a366dee3395770d0dd4e273e8a5c69 0 parents
@hiddenmemory authored
15 basic/Test01.input
@@ -0,0 +1,15 @@
+Basic template expansion:
+
+{{# def page title client }}
+<html>
+ <head>
+ <title>{{ title }}</title>
+ <meta name="author" value="{{ author }}">
+ </head>
+ <body>{{ client }}</body>
+</html>
+{{/ def }}
+
+{{ def title="This is a title" }}
+{{ def client="This is a client" }}
+{{ page title=title client=client }}
50 basic/Test02.input
@@ -0,0 +1,50 @@
+Environment capture within the templates, more complicated invocation:
+
+{{def author "Chris Ross"}}
+
+{{#def case_study title client_cs description_cs platform_cs testimonial_cs literal }}
+<html>
+ <head>
+ <title>{{ title }}</title>
+ <meta name="author" value="{{ author }}">
+ </head>
+ <body>
+ <h1>{{title_cs}}</h1>
+ <h2>Client: {{client_cs}}</h2>
+
+ {{description_cs}}
+
+ <h3>Platform</h3>
+ <blockquote>{{platform_cs}}</blockquote>
+
+ <h3>Testimonial</h3>
+ {{Testimonial_cs}}
+
+ <h4>Technologies</h4>
+ {{technologies}}
+
+ {{testvalue}}
+
+ version {{literal}}
+ </body>
+</html>
+{{/def}}
+
+{{#case_study
+ title=title
+ client_cs=""
+ description_cs="This is a description_cs"
+ platform_cs="iPhone, iPad"
+ testimonial_cs="These guys rocked it"
+ literal="v1.0"
+ }}
+ {{# bind testvalue }}
+ Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
+ {{/ bind }}
+ {{# bind client_cs }}Box and Arrow Ltd{{/ bind }}
+{{# bind technologies}}ALL OF THEM!{{/bind}}
+{{/case_study}}
+
+{{ foo }}
+
+{{ // This is a comment }}
38 basic/Test03.input
@@ -0,0 +1,38 @@
+Scoping check - watch the evaluation value of Z:
+
+{{#def A}}
+ {{ValueB}}
+{{/def}}
+
+{{def ValueB "This is ValueB"}}
+
+{{#def B}}
+ {{ValueB}}
+{{/def}}
+
+{{#def X}}
+ Begin X
+ {{#def Z}}
+ Z has been here.
+ {{/def Z}}
+ Begin Y
+ {{#def Y}}
+ [1] Z has been here:
+ {{Z}}
+ Begin Z
+ {{#def Z}}
+ Z hath been here.
+ {{/def Z}}
+ [2] Z hath been here:
+ {{Z}}
+ {{/def Y}}
+ {{Y}}
+ [3] Z has been here:
+ {{Z}}
+{{/def X}}
+
+{{A}}
+
+{{B}}
+
+{{X}}
44 basic/Test04.input
@@ -0,0 +1,44 @@
+Test for named parameters, check against bind pollution:
+
+{{def PollutionLevelFine="Pollution free zone"}}
+{{def PollutionLevel=PollutionLevelFine}}
+
+{{#def lorem}}
+Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
+{{/def}}
+
+{{#def test title="Default Title" content="Default Content"}}
+<title>{{title}}</title>
+<content>{{content}}</content>
+<pollution-level>{{PollutionLevel}}</pollution-level>
+{{/def}}
+
+-------------------
+No arguments:
+{{test}}
+-------------------
+
+-------------------
+Inline arguments:
+{{test content="Inline Content" title="Inline Title"}}
+-------------------
+
+-------------------
+Inline and bind arguments:
+{{#test title="Inline and bind"}}
+{{#bind content}}
+ {{lorem}}
+{{/bind}}
+{{#bind PollutionLevel}}
+ Polluting all the way.
+{{/bind}}
+{{/test}}
+-------------------
+
+-------------------
+Inline and bind arguments:
+{{#test title="Inline and bind"}}
+{{bind content="Bound content"}}
+{{bind PollutionLevel="Polluting all the way."}}
+{{/test}}
+-------------------
29 basic/Test05.input
@@ -0,0 +1,29 @@
+Check lazy evaluation of parameters allowing templates to be passed to templates:
+
+{{#def dynamic_list_item value="Test Value"}}
+ <li> {{value}} </li>
+{{/def}}
+
+{{#def list list_item="<li>No template</li>"}}
+<ol>
+ {{list_item value="Chris"}}
+ {{list_item value="Dave"}}
+ {{list_item value="Tipi"}}
+</ol>
+{{/def}}
+
+{{list}}
+
+{{list list_item="<li>Static template</li>"}}
+
+{{list list_item=dynamic_list_item}}
+
+{{#list}}
+ {{bind list_item=dynamic_list_item}}
+{{/list}}
+
+{{#list}}
+ {{#bind list_item}}
+ {{dynamic_list_item value="Evaluate bind"}}
+ {{/bind}}
+{{/list}}
16 basic/Test06.input
@@ -0,0 +1,16 @@
+Check for multiple assignment within def and bind tags:
+
+{{def A="the letter A" B="the letter B"}}
+
+{{A}}
+
+{{B}}
+
+{{#def bind_test A="Abort" B="Bailout"}}
+ {{A}}
+ {{B}}
+{{/def}}
+
+{{#bind_test}}
+ {{bind A=A B=B}}
+{{/bind_test}}
Please sign in to comment.
Something went wrong with that request. Please try again.