# Example/test Template

1. <?tmpl.file?> tests
2. <?tmpl.if?> tests
3. <?tmpl.session?> test
4. <?tmpl.unless?> tests
5. <?tmpl.var?> tests

### <?tmpl.file ?> Tests

^^ Top ^^

Test Name | Test | Expected Output
<?tmpl.file name="include_tmpl.tmpl" ?> |  | A non-recursive included file
<?tmpl.file name="include_docs.tmpl" relative="yes" ?> |  | A non-recursive included file (file in docs directory)
<?tmpl.file name="non_existent_file.tmpl" ?> |  | File "non_existent_file.tmpl" does not exist in the path ".:./tmpl"
<?tmpl.file name="non_existent_file.tmpl" error_msg="file not found" ?> |  | file not found
<?tmpl.file name="include_recursive.tmpl" ?> |  | ##1st FILE ## ##BEGIN 2ND INCLUDE##--2nd FILE--##END 2ND INCLUDE##
<?tmpl.file name="include_widget.tmpl" ns='' ?> |  | Basic widget that is color blue
<?tmpl.file name="include_widget.tmpl" ns='top' ?> |  | Basic widget that is color green
<?tmpl.file name="include_widget.tmpl" ns='bottom' ?> |  | Basic widget that is color red

### <?tmpl.if ?> Tests

^^ Top ^^

Test Name | Test | Expected Output
<?tmpl.if name="test" type="block" ?> | Testing worked | Testing worked

### <?tmpl.session ?> Tests

^^ Top ^^

Test Name | Test | Expected Output
<a href="http://ruby-tmpl.sourceforge.net/">ruby-tmpl testing session</a> | ruby-tmpl testing session | <a href="http://ruby-tmpl.sourceforge.net/?session=0123456789abcdef0123456789abcdef">ruby-tmpl testing session</a>
<a href="http://ruby-tmpl.sourceforge.net/?session=existing_session">ruby-tmpl testing existing session</a> | ruby-tmpl testing existing session | <a href="http://ruby-tmpl.sourceforge.net/?session=existing_session">ruby-tmpl testing existing session</a>
<?tmpl.session name="0123456789abcdef0123456789abcdef" ?> |  | 0123456789abcdef0123456789abcdef
<?tmpl.session ?> |  | 0123456789abcdef0123456789abcdef

### <?tmpl.unless ?> Tests

^^ Top ^^

Test Name | Test | Expected Output
<?tmpl.unless name="foobar" type="block" ?> | Testing worked | Testing worked

### <tmpl.var ?> Tests

^^ Top ^^

Test Name | Test | Expected Output
<?tmpl.var ?> |  | ruby-tmpl worked
<?tmpl.var name="test" default="default value" ?> |  | ruby-tmpl worked
<?tmpl.var name="bad_variable" ?> |  | variable "bad_variable" has no value
<?tmpl.var name="bad_variable" default="default value" ?> |  | default value

Tests completed. Feel free to direct questions to ruby-tmpl-users@lists.sourceforge.net.