Modul:Error/testiranje

Dokumentaciju za ovaj modul možete napraviti na stranici Modul:Error/testiranje/dok

-- Example 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|&#x0000;}}', '{{Error|&#x0000;}}') -- 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/igralište}}')
    self:preprocess_equals_preprocess('{{#invoke:Error|error}}', '{{Error/igralište}}', {nowiki = 'yes'})
    self:preprocess_equals_preprocess('{{#invoke:Error|error|}}', '{{Error/igralište|}}')
    self:preprocess_equals_preprocess('{{#invoke:Error|error| }}', '{{Error/igralište| }}') -- space &#x20;
    self:preprocess_equals_preprocess('{{#invoke:Error|error|{{!}}}}', '{{Error/igralište|{{!}}}}')
    self:preprocess_equals_preprocess('{{#invoke:Error|error|{{!}}tag=p}}', '{{Error/igralište|{{!}}tag=p}}')
    self:preprocess_equals_preprocess('{{#invoke:Error|error|message=}}', '{{Error/igralište|message=}}')
    self:preprocess_equals_preprocess('{{#invoke:Error|error|message=}}', '{{Error/igralište|message=}}', {nowiki = 'yes'})
    self:preprocess_equals_preprocess('{{#invoke:Error|error|message=|tag=p}}', '{{Error/igralište|message=|tag=p}}')
    self:preprocess_equals_preprocess('{{#invoke:Error|error|1=}}', '{{Error/igralište|1=}}')
    self:preprocess_equals_preprocess('{{#invoke:Error|error|1=}}', '{{Error/igralište|1=}}', {nowiki = 'yes'})
    self:preprocess_equals_preprocess('{{#invoke:Error|error|1=|tag=p}}', '{{Error/igralište|1=|tag=p}}')

    -- Plain message
    self:preprocess_equals_preprocess('{{#invoke:Error|error|Example error message}}', '{{Error/igralište|Example error message}}')
    self:preprocess_equals_preprocess('{{#invoke:Error|error|  Example error message  }}', '{{Error/igralište|  Example error message  }}')
    self:preprocess_equals_preprocess('{{#invoke:Error|error|message=Example error message}}', '{{Error/igralište|message=Example error message}}')
    self:preprocess_equals_preprocess('{{#invoke:Error|error|message =  Example error message  }}', '{{Error/igralište|message =  Example error message  }}')
    -- tag
    self:preprocess_equals_preprocess('{{#invoke:Error|error|Example error message|tag=p}}', '{{Error/igralište|Example error message|tag=p}}')
    self:preprocess_equals_preprocess('{{#invoke:Error|error|tag=p}}', '{{Error/igralište|tag=p}}') -- no message
    self:preprocess_equals_preprocess('{{#invoke:Error|error|Example error message| tag = p}}', '{{Error/igralište|Example error message| tag = p}}')
    self:preprocess_equals_preprocess('{{#invoke:Error|error|Example error message|tag=div}}', '{{Error/igralište|Example error message|tag=div}}')
    self:preprocess_equals_preprocess('{{#invoke:Error|error|Example error message|tag=div}}', '{{Error/igralište|Example error message|tag=div}}')
    self:preprocess_equals_preprocess('{{#invoke:Error|error|Example error message|tag=span}}', '{{Error/igralište|Example error message|tag=span}}')
    self:preprocess_equals_preprocess('{{#invoke:Error|error|Example error message|tag=adsf}}', '{{Error/igralište|Example error message|tag=asdf}}')
    self:preprocess_equals_preprocess('{{#invoke:Error|error|Example error message|tag=strong}}', '{{Error/igralište|Example error message|tag=strong}}')
    self:preprocess_equals_preprocess('{{#invoke:Error|error|Example error message|tag=&#x0000;}}', '{{Error/igralište|Example error message|tag=&#x0000;}}') -- ASCII nul
    self:preprocess_equals_preprocess('{{#invoke:Error|error|Example error message|tag= }}', '{{Error/igralište|Example error message|tag= }}') -- nbsp
    self:preprocess_equals_preprocess('{{#invoke:Error|error|Example error message|tag={{!}}}}', '{{Error/igralište|Example error message|tag={{!}}}}')
    -- Use numbered parameter
    self:preprocess_equals_preprocess('{{#invoke:Error|error|1=Example error message}}', '{{Error/igralište|1=Example error message}}')
    self:preprocess_equals_preprocess('{{#invoke:Error|error|1=  Example error message  }}', '{{Error/igralište|1=  Example error message  }}')
    self:preprocess_equals_preprocess('{{#invoke:Error|error|Example = message}}', '{{Error/igralište|Example = message}}')
    self:preprocess_equals_preprocess('{{#invoke:Error|error|1=  Example = message  }}', '{{Error/igralište|1=  Example = message  }}')
    -- More extreme input options
    self:preprocess_equals_preprocess('{{#invoke:Error|error| }}', '{{Error/igralište| }}') -- nbsp
    self:preprocess_equals_preprocess('{{#invoke:Error|error|<br/>}}', '{{Error/igralište|<br/>}}')
    self:preprocess_equals_preprocess('{{#invoke:Error|error|\n}}', '{{Error/igralište|\n}}', {nowiki = 'yes'})
    self:preprocess_equals_preprocess('{{#invoke:Error|error|&#x0000;}}', '{{Error/igralište|&#x0000;}}') -- ASCII nul

    -- Tricky input options
    self:preprocess_equals_preprocess('{{#invoke:Error|error|0}}', '{{Error/igralište|0}}')
    self:preprocess_equals_preprocess('{{#invoke:Error|error|false}}', '{{Error/igralište|false}}')
    self:preprocess_equals_preprocess('{{#invoke:Error|error|tag=tag}}', '{{Error/igralište|tag=tag}}', {nowiki = 'yes'})
    self:preprocess_equals_preprocess('{{#invoke:Error|error|1}}', '{{Error/igralište|1}}')
    self:preprocess_equals_preprocess('{{#invoke:Error|error|true}}', '{{Error/igralište|true}}')
end

return p