Koha Test Wiki MW Canasta on Koha Portainer
Test major Koha Wiki changes or bug fixes here without fear of breaking the production wiki.
For the current Koha Wiki, visit https://wiki.koha-community.org .Module:Error/testcases
Jump to navigation
Jump to search
Documentation for this module may be created at Module:Error/testcases/doc
-- Unit tests for [[Module:Error]]. Click talk page to run tests.
local p = require('Module:UnitTests')
function p:test_error()
-- Minimal parameter input
self:preprocess_equals_preprocess('{{#invoke:Error|error}}', '{{Error}}')
self:preprocess_equals_preprocess('{{#invoke:Error|error}}', '{{Error}}', {nowiki = 'yes'})
self:preprocess_equals_preprocess('{{#invoke:Error|error|}}', '{{Error|}}')
self:preprocess_equals_preprocess('{{#invoke:Error|error| }}', '{{Error| }}') -- space  
self:preprocess_equals_preprocess('{{#invoke:Error|error|{{!}}}}', '{{Error|{{!}}}}')
self:preprocess_equals_preprocess('{{#invoke:Error|error|{{!}}tag=p}}', '{{Error|{{!}}tag=p}}')
self:preprocess_equals_preprocess('{{#invoke:Error|error|message=}}', '{{Error|message=}}')
self:preprocess_equals_preprocess('{{#invoke:Error|error|message=}}', '{{Error|message=}}', {nowiki = 'yes'})
self:preprocess_equals_preprocess('{{#invoke:Error|error|message=|tag=p}}', '{{Error|message=|tag=p}}')
self:preprocess_equals_preprocess('{{#invoke:Error|error|1=}}', '{{Error|1=}}')
self:preprocess_equals_preprocess('{{#invoke:Error|error|1=}}', '{{Error|1=}}', {nowiki = 'yes'})
self:preprocess_equals_preprocess('{{#invoke:Error|error|1=|tag=p}}', '{{Error|1=|tag=p}}')
-- Plain message
self:preprocess_equals_preprocess('{{#invoke:Error|error|Example error message}}', '{{Error|Example error message}}')
self:preprocess_equals_preprocess('{{#invoke:Error|error| Example error message }}', '{{Error| Example error message }}')
self:preprocess_equals_preprocess('{{#invoke:Error|error|message=Example error message}}', '{{Error|message=Example error message}}')
self:preprocess_equals_preprocess('{{#invoke:Error|error|message = Example error message }}', '{{Error|message = Example error message }}')
-- tag
self:preprocess_equals_preprocess('{{#invoke:Error|error|Example error message|tag=p}}', '{{Error|Example error message|tag=p}}')
self:preprocess_equals_preprocess('{{#invoke:Error|error|tag=p}}', '{{Error|tag=p}}') -- no message
self:preprocess_equals_preprocess('{{#invoke:Error|error|Example error message| tag = p}}', '{{Error|Example error message| tag = p}}', {nowiki = 'yes'})
self:preprocess_equals_preprocess('{{#invoke:Error|error|Example error message|tag=div}}', '{{Error|Example error message|tag=div}}')
self:preprocess_equals_preprocess('{{#invoke:Error|error|Example error message|tag=div}}', '{{Error|Example error message|tag=div}}')
self:preprocess_equals_preprocess('{{#invoke:Error|error|Example error message|tag=span}}', '{{Error|Example error message|tag=span}}')
self:preprocess_equals_preprocess('{{#invoke:Error|error|Example error message|tag=adsf}}', '{{Error|Example error message|tag=asdf}}')
self:preprocess_equals_preprocess('{{#invoke:Error|error|Example error message|tag=strong}}', '{{Error|Example error message|tag=strong}}')
self:preprocess_equals_preprocess('{{#invoke:Error|error|Example error message|tag=�}}', '{{Error|Example error message|tag=�}}') -- ASCII nul
self:preprocess_equals_preprocess('{{#invoke:Error|error|Example error message|tag= }}', '{{Error|Example error message|tag= }}') -- nbsp
self:preprocess_equals_preprocess('{{#invoke:Error|error|Example error message|tag={{!}}}}', '{{Error|Example error message|tag={{!}}}}')
-- Use numbered parameter
self:preprocess_equals_preprocess('{{#invoke:Error|error|1=Example error message}}', '{{Error|1=Example error message}}')
self:preprocess_equals_preprocess('{{#invoke:Error|error|1= Example error message }}', '{{Error|1= Example error message }}')
self:preprocess_equals_preprocess('{{#invoke:Error|error|Example = message}}', '{{Error|Example = message}}')
self:preprocess_equals_preprocess('{{#invoke:Error|error|1= Example = message }}', '{{Error|1= Example = message }}')
-- More extreme input options
self:preprocess_equals_preprocess('{{#invoke:Error|error| }}', '{{Error| }}') -- nbsp
self:preprocess_equals_preprocess('{{#invoke:Error|error|<br/>}}', '{{Error|<br/>}}')
self:preprocess_equals_preprocess('{{#invoke:Error|error|\n}}', '{{Error|\n}}', {nowiki = 'yes'})
self:preprocess_equals_preprocess('{{#invoke:Error|error|�}}', '{{Error|�}}') -- ASCII nul
-- Tricky input options
self:preprocess_equals_preprocess('{{#invoke:Error|error|0}}', '{{Error|0}}') -- nbsp
self:preprocess_equals_preprocess('{{#invoke:Error|error|false}}', '{{Error|false}}')
self:preprocess_equals_preprocess('{{#invoke:Error|error|tag=tag}}', '{{Error|tag=tag}}')
self:preprocess_equals_preprocess('{{#invoke:Error|error|1}}', '{{Error|1}}')
self:preprocess_equals_preprocess('{{#invoke:Error|error|true}}', '{{Error|true}}')
end
function p:test_error_sandbox()
-- Minimal parameter input
self:preprocess_equals_preprocess('{{#invoke:Error|error}}', '{{Error/sandbox}}')
self:preprocess_equals_preprocess('{{#invoke:Error|error}}', '{{Error/sandbox}}', {nowiki = 'yes'})
self:preprocess_equals_preprocess('{{#invoke:Error|error|}}', '{{Error/sandbox|}}')
self:preprocess_equals_preprocess('{{#invoke:Error|error| }}', '{{Error/sandbox| }}') -- space  
self:preprocess_equals_preprocess('{{#invoke:Error|error|{{!}}}}', '{{Error/sandbox|{{!}}}}')
self:preprocess_equals_preprocess('{{#invoke:Error|error|{{!}}tag=p}}', '{{Error/sandbox|{{!}}tag=p}}')
self:preprocess_equals_preprocess('{{#invoke:Error|error|message=}}', '{{Error/sandbox|message=}}')
self:preprocess_equals_preprocess('{{#invoke:Error|error|message=}}', '{{Error/sandbox|message=}}', {nowiki = 'yes'})
self:preprocess_equals_preprocess('{{#invoke:Error|error|message=|tag=p}}', '{{Error/sandbox|message=|tag=p}}')
self:preprocess_equals_preprocess('{{#invoke:Error|error|1=}}', '{{Error/sandbox|1=}}')
self:preprocess_equals_preprocess('{{#invoke:Error|error|1=}}', '{{Error/sandbox|1=}}', {nowiki = 'yes'})
self:preprocess_equals_preprocess('{{#invoke:Error|error|1=|tag=p}}', '{{Error/sandbox|1=|tag=p}}')
-- Plain message
self:preprocess_equals_preprocess('{{#invoke:Error|error|Example error message}}', '{{Error/sandbox|Example error message}}')
self:preprocess_equals_preprocess('{{#invoke:Error|error| Example error message }}', '{{Error/sandbox| Example error message }}')
self:preprocess_equals_preprocess('{{#invoke:Error|error|message=Example error message}}', '{{Error/sandbox|message=Example error message}}')
self:preprocess_equals_preprocess('{{#invoke:Error|error|message = Example error message }}', '{{Error/sandbox|message = Example error message }}')
-- tag
self:preprocess_equals_preprocess('{{#invoke:Error|error|Example error message|tag=p}}', '{{Error/sandbox|Example error message|tag=p}}')
self:preprocess_equals_preprocess('{{#invoke:Error|error|tag=p}}', '{{Error/sandbox|tag=p}}') -- no message
self:preprocess_equals_preprocess('{{#invoke:Error|error|Example error message| tag = p}}', '{{Error/sandbox|Example error message| tag = p}}')
self:preprocess_equals_preprocess('{{#invoke:Error|error|Example error message|tag=div}}', '{{Error/sandbox|Example error message|tag=div}}')
self:preprocess_equals_preprocess('{{#invoke:Error|error|Example error message|tag=div}}', '{{Error/sandbox|Example error message|tag=div}}')
self:preprocess_equals_preprocess('{{#invoke:Error|error|Example error message|tag=span}}', '{{Error/sandbox|Example error message|tag=span}}')
self:preprocess_equals_preprocess('{{#invoke:Error|error|Example error message|tag=adsf}}', '{{Error/sandbox|Example error message|tag=asdf}}')
self:preprocess_equals_preprocess('{{#invoke:Error|error|Example error message|tag=strong}}', '{{Error/sandbox|Example error message|tag=strong}}')
self:preprocess_equals_preprocess('{{#invoke:Error|error|Example error message|tag=�}}', '{{Error/sandbox|Example error message|tag=�}}') -- ASCII nul
self:preprocess_equals_preprocess('{{#invoke:Error|error|Example error message|tag= }}', '{{Error/sandbox|Example error message|tag= }}') -- nbsp
self:preprocess_equals_preprocess('{{#invoke:Error|error|Example error message|tag={{!}}}}', '{{Error/sandbox|Example error message|tag={{!}}}}')
-- Use numbered parameter
self:preprocess_equals_preprocess('{{#invoke:Error|error|1=Example error message}}', '{{Error/sandbox|1=Example error message}}')
self:preprocess_equals_preprocess('{{#invoke:Error|error|1= Example error message }}', '{{Error/sandbox|1= Example error message }}')
self:preprocess_equals_preprocess('{{#invoke:Error|error|Example = message}}', '{{Error/sandbox|Example = message}}')
self:preprocess_equals_preprocess('{{#invoke:Error|error|1= Example = message }}', '{{Error/sandbox|1= Example = message }}')
-- More extreme input options
self:preprocess_equals_preprocess('{{#invoke:Error|error| }}', '{{Error/sandbox| }}') -- nbsp
self:preprocess_equals_preprocess('{{#invoke:Error|error|<br/>}}', '{{Error/sandbox|<br/>}}')
self:preprocess_equals_preprocess('{{#invoke:Error|error|\n}}', '{{Error/sandbox|\n}}', {nowiki = 'yes'})
self:preprocess_equals_preprocess('{{#invoke:Error|error|�}}', '{{Error/sandbox|�}}') -- ASCII nul
-- Tricky input options
self:preprocess_equals_preprocess('{{#invoke:Error|error|0}}', '{{Error/sandbox|0}}')
self:preprocess_equals_preprocess('{{#invoke:Error|error|false}}', '{{Error/sandbox|false}}')
self:preprocess_equals_preprocess('{{#invoke:Error|error|tag=tag}}', '{{Error/sandbox|tag=tag}}', {nowiki = 'yes'})
self:preprocess_equals_preprocess('{{#invoke:Error|error|1}}', '{{Error/sandbox|1}}')
self:preprocess_equals_preprocess('{{#invoke:Error|error|true}}', '{{Error/sandbox|true}}')
end
return p