Module:Convert/tester/doc
This is the documentation page for Module:Convert/tester
Testcases example redaguoti
- Module:Convert/sandbox/testcases • templates to be tested, with expected outputs
- Module talk:Convert/sandbox/testcases • view test results
It is not necessary to save the testcases page before viewing test results. For example, Module:Convert/sandbox/testcases could be edited to change the tests. While still editing that page, paste "Module talk:Convert/sandbox/testcases
" (without quotes) into the page title box under "Preview page with this template", then click "Show preview".
The testcases talk page (for example, Module talk:Convert/sandbox/testcases) contains:
{{#invoke:convert/sandbox/testcases|run_tests}}
The testcases module page (for example, Module:Convert/sandbox/testcases) may contain:
local tests = [==[
A template to be tested must be at the start of a line.
Lines which do not start with a template are ignored.
{{convert/sandbox|1|acre|lk=on}} 1 [[acre]] (0.40 [[hectare|ha]])
{{convert/sandbox|1|m2|acres|lk=on}} 1 [[square metre]] (0.00025 [[acre]]s)
{{convert/sandbox|0.16|/l|2|disp=table}} align="right"|0.16\n|align="right"|0.61
]==]
local p = require('Module:Convert/tester')
p.tests = tests
return p
If wanted, the tests can be run using a template different from the one specified in the tests. For example, the following would run the tests from Module:Convert/sandbox/testcases, but would change the name of each template found on that page to "convert/sandbox2
".
{{#invoke:convert/sandbox/testcases|run_tests|template=convert/sandbox2}}