Template:UnitTest/doc

From Terraria Wiki
Jump to navigation Jump to search

This simple helper template facilitates unit tests. It is to be used in template documentation and will categorize the page in Category:Templates with unit test failed if the unit test fails.

Usage

{{ unitTest | <expected result> | <actual result> }}

First unnamed parameter

Expected result, i.e. the hardcoded template output.

Second unnamed parameter

Actual result, i.e. the transclusion of the template.

Examples

Code Result
{{unitTest| 10 | {{sum|2|8}} }} 10
{{unitTest| 11 | {{sum|2|8}} }} 10 FAIL! (expected: 11)