Module:RQ:pi:Sai Kam Mong/testcases
Appearance
- The following documentation is located at Module:RQ:pi:Sai Kam Mong/testcases/documentation. [edit]
- Useful links: root page • root page’s subpages • links • transclusions • tested module • sandbox
All tests passed. (refresh)
Text | Expected | Actual | |
---|---|---|---|
{{#invoke:RQ:pi:Sai Kam Mong|quote|241|namo|3}} | |||
{{#invoke:RQ:pi:Sai Kam Mong|quote|241|namo|7}} | |||
{{#invoke:RQ:pi:Sai Kam Mong|quote|241|namo|0}} | |||
{{#invoke:RQ:pi:Sai Kam Mong|quote|242|namo|3}} | There are no passages from page 242 | There are no passages from page 242 | |
{{#invoke:RQ:pi:Sai Kam Mong|quote|241|nosuch|3}} | No passage dubbed "nosuch" on page 241 | No passage dubbed "nosuch" on page 241 | |
{{#invoke:RQ:pi:Sai Kam Mong|quote|241|namo}} | |||
{{#invoke:RQ:pi:Sai Kam Mong|quote|241}} | Passage ID is missing | Passage ID is missing | |
{{#invoke:RQ:pi:Sai Kam Mong|quote|xxx|namo|3}} | There are no passages from page xxx | There are no passages from page xxx | |
{{#invoke:RQ:pi:Sai Kam Mong|quote}} | Invalid or missing page number | Invalid or missing page number |
Text | Expected | Actual | |
---|---|---|---|
{{RQ:pi:Sai Kam Mong quote| 241 | namo | 3 }} | |||
{{RQ:pi:Sai Kam Mong quote| 241 | namo | 7 }} | |||
{{RQ:pi:Sai Kam Mong quote| 241 | namo | 0 }} | |||
{{RQ:pi:Sai Kam Mong quote| 242 | namo | 3 }} | There are no passages from page 242 | There are no passages from page 242 | |
{{RQ:pi:Sai Kam Mong quote| 241 | nosuch | 3 }} | No passage dubbed "nosuch" on page 241 | No passage dubbed "nosuch" on page 241 | |
{{RQ:pi:Sai Kam Mong quote| 241 | namo }} | |||
{{RQ:pi:Sai Kam Mong quote| 241 }} | Passage ID is missing | Passage ID is missing | |
{{RQ:pi:Sai Kam Mong quote | xxx | namo | 3 }} | There are no passages from page xxx | There are no passages from page xxx | |
{{RQ:pi:Sai Kam Mong quote}} | Invalid or missing page number | Invalid or missing page number |
local tests = require('Module:UnitTests')
function tests:test_direct()
--[[ here be the tests ]]
-- simple case:
tests:preprocess_equals_preprocess(
"{{#invoke:RQ:pi:Sai Kam Mong|quote|241|namo|3}}",
"{{RQ:pi:Sai Kam Mong|241\n"..
"|ᨶᨾᩮᩣᨲᩔ '''ᨽᨣᩅᨲᩮᩣ''' ᩋᩁᩉᨲᩮᩣ ᩈᨾᩜᩣᩈᨾ᩠ᨻᩩᨴ᩠ᨵᩔ\n"..
"|namotassa '''bhagavato''' arahato sammāsambuddhassa\n"..
"|Honour to the '''Blessed One''', the Exalted One, the fully Enlightened One}}")
-- nested string
tests:preprocess_equals_preprocess(
"{{#invoke:RQ:pi:Sai Kam Mong|quote|241|namo|7}}",
"{{RQ:pi:Sai Kam Mong|241\n"..
"|ᨶᨾᩮᩣᨲᩔ ᨽᨣᩅᨲᩮᩣ ᩋᩁᩉᨲᩮᩣ '''ᩈᨾᩜᩣᩈᨾ᩠ᨻᩩᨴ᩠ᨵᩔ'''\n"..
"|namotassa bhagavato arahato '''sammāsambuddhassa'''\n"..
"|Honour to the Blessed One, the Exalted One, '''the fully Enlightened One'''}}")
-- No highlighting
tests:preprocess_equals_preprocess(
"{{#invoke:RQ:pi:Sai Kam Mong|quote|241|namo|0}}",
"{{RQ:pi:Sai Kam Mong|241\n"..
"|ᨶᨾᩮᩣᨲᩔ ᨽᨣᩅᨲᩮᩣ ᩋᩁᩉᨲᩮᩣ ᩈᨾᩜᩣᩈᨾ᩠ᨻᩩᨴ᩠ᨵᩔ\n"..
"|namotassa bhagavato arahato sammāsambuddhassa\n"..
"|Honour to the Blessed One, the Exalted One, the fully Enlightened One}}")
-- Wrong page
tests:preprocess_equals(
"{{#invoke:RQ:pi:Sai Kam Mong|quote|242|namo|3}}",
"There are no passages from page 242")
-- Wrong ID:
tests:preprocess_equals_preprocess(
"{{#invoke:RQ:pi:Sai Kam Mong|quote|241|nosuch|3}}",
"No passage dubbed \"nosuch\" on page 241")
-- No word specified:
tests:preprocess_equals_preprocess(
"{{#invoke:RQ:pi:Sai Kam Mong|quote|241|namo}}",
"{{#invoke:RQ:pi:Sai Kam Mong|quote|241|namo|0}}")
-- No ID specified:
tests:preprocess_equals_preprocess(
"{{#invoke:RQ:pi:Sai Kam Mong|quote|241}}",
"Passage ID is missing")
-- Page is not a number
tests:preprocess_equals(
"{{#invoke:RQ:pi:Sai Kam Mong|quote|xxx|namo|3}}",
"There are no passages from page xxx")
-- No page number
tests:preprocess_equals(
"{{#invoke:RQ:pi:Sai Kam Mong|quote}}",
"Invalid or missing page number")
end
function tests:test_template()
--[[ here be the tests ]]
-- simple case:
tests:preprocess_equals_preprocess(
"{{RQ:pi:Sai Kam Mong quote| 241 | namo | 3 }}",
"{{#invoke:RQ:pi:Sai Kam Mong|quote|241|namo|3}}")
-- nested string
tests:preprocess_equals_preprocess(
"{{RQ:pi:Sai Kam Mong quote| 241 | namo | 7 }}",
"{{#invoke:RQ:pi:Sai Kam Mong|quote|241|namo|7}}")
-- No highlighting
tests:preprocess_equals_preprocess(
"{{RQ:pi:Sai Kam Mong quote| 241 | namo | 0 }}",
"{{#invoke:RQ:pi:Sai Kam Mong|quote|241|namo|0}}")
-- Wrong page
tests:preprocess_equals_preprocess(
"{{RQ:pi:Sai Kam Mong quote| 242 | namo | 3 }}",
"{{#invoke:RQ:pi:Sai Kam Mong|quote|242|namo|3}}")
-- Wrong ID:
tests:preprocess_equals_preprocess(
"{{RQ:pi:Sai Kam Mong quote| 241 | nosuch | 3 }}",
"{{#invoke:RQ:pi:Sai Kam Mong|quote|241|nosuch|3}}")
-- No word specified:
tests:preprocess_equals_preprocess(
"{{RQ:pi:Sai Kam Mong quote| 241 | namo }}",
"{{#invoke:RQ:pi:Sai Kam Mong|quote|241|namo}}")
-- No ID specified:
tests:preprocess_equals_preprocess(
"{{RQ:pi:Sai Kam Mong quote| 241 }}",
"{{#invoke:RQ:pi:Sai Kam Mong|quote|241}}")
-- Page is not a number
tests:preprocess_equals_preprocess(
"{{RQ:pi:Sai Kam Mong quote | xxx | namo | 3 }}",
"{{#invoke:RQ:pi:Sai Kam Mong|quote|xxx|namo|3}}")
-- No page number
tests:preprocess_equals_preprocess(
"{{RQ:pi:Sai Kam Mong quote}}",
"{{#invoke:RQ:pi:Sai Kam Mong|quote}}")
end
return tests