Module:Side annotation/testcases
外观
这是模块Module:Side annotation的测试用例。测试结果在此 |
-- Unit tests for [[Module:Side annotation]]. 在討論頁查看運行結果。
local p = require('Module:UnitTests')
function p:test_main()
self:preprocess_equals('{{#invoke:Side annotation|main|第一行正文|第一行注釋}}', '<span class="wst-side-container"><span class="wst-side-text-row">第一行正文<span class="wst-side-annotation-box"><span class="wst-side-delimiter">〈</span><span class="wst-side-annotation-row">第一行注釋</span><span class="wst-side-delimiter">〉</span></span></span></span>', {nowiki=1})
self:preprocess_equals('{{#invoke:Side annotation|main|第一行正文|第二行正文|第一行注釋|第二行注釋}}', '<span class="wst-side-container"><span class="wst-side-text-row">第一行正文</span><span class="wst-side-text-row">第二行正文<span class="wst-side-annotation-box"><span class="wst-side-delimiter">〈</span><span class="wst-side-annotation-row">第一行注釋</span><span class="wst-side-annotation-row">第二行注釋</span><span class="wst-side-delimiter">〉</span></span></span></span>', {nowiki=1})
self:preprocess_equals('{{#invoke:Side annotation|main|第一行正文|第二行正文|第三行正文|第一行注釋|第二行注釋|第三行注釋}}', '<span class="wst-side-container"><span class="wst-side-text-row">第一行正文</span><span class="wst-side-text-row">第二行正文</span><span class="wst-side-text-row">第三行正文<span class="wst-side-annotation-box"><span class="wst-side-delimiter">〈</span><span class="wst-side-annotation-row">第一行注釋</span><span class="wst-side-annotation-row">第二行注釋</span><span class="wst-side-annotation-row">第三行注釋</span><span class="wst-side-delimiter">〉</span></span></span></span>', {nowiki=1})
self:preprocess_equals('{{#invoke:Side annotation|main|第一行正文|第二行正文|第三行正文|第一行注釋|第二行注釋|第三行注釋|color=red}}', '<span class="wst-side-container"><span class="wst-side-text-row">第一行正文</span><span class="wst-side-text-row">第二行正文</span><span class="wst-side-text-row">第三行正文<span class="wst-side-annotation-box" style="color:red"><span class="wst-side-delimiter">〈</span><span class="wst-side-annotation-row">第一行注釋</span><span class="wst-side-annotation-row">第二行注釋</span><span class="wst-side-annotation-row">第三行注釋</span><span class="wst-side-delimiter">〉</span></span></span></span>', {nowiki=1})
end
function p:test_start()
self:preprocess_equals('{{#invoke:Side annotation|start}}', '<span class="wst-side-container">', {nowiki=1})
self:preprocess_equals('{{#invoke:Side annotation|start|第一行正文|第二行正文|第一行注釋|第二行注釋|file=Sandbox.djvu|page=32|section=side-01}}', '<span class="wst-side-container"><span class="wst-side-text-row">第一行正文</span><span class="wst-side-text-row">第二行正文</span><span class="wst-side-text-row">有此人,咸來問訊。<span class="wst-side-annotation-box"><span class="wst-side-delimiter">〈</span><span class="wst-side-annotation-row">第一行注釋</span><span class="wst-side-annotation-row">第二行注釋</span>', {nowiki=1})
self:preprocess_equals('{{#invoke:Side annotation|start|第一行正文|第二行正文|第一行注釋|第二行注釋|file=Sandbox.djvu|page=32|color=blue|class=AB CD}}', '<span class="wst-side-container"><span class="wst-side-text-row">第一行正文</span><span class="wst-side-text-row">第二行正文</span><span class="wst-side-text-row">有此人,咸來問訊。<span class="wst-side-annotation-box wst-side-annotation-s-ABCD" style="color:blue"><span class="wst-side-delimiter">〈</span><span class="wst-side-annotation-row">第一行注釋</span><span class="wst-side-annotation-row">第二行注釋</span>', {nowiki=1})
self:preprocess_equals('{{#invoke:Side annotation|start|見漁人,乃大驚,問所|從來。具答之。便要還家,設酒殺鷄作食。村中聞|第一行注釋|第二行整行的注釋|file=Sandbox.djvu|page=32|section=side-01}}', '<span class="wst-side-container"><span class="wst-side-text-row">見漁人,乃大驚,問所</span><span class="wst-side-text-row">從來。具答之。便要還家,設酒殺鷄作食。村中聞</span><span class="wst-side-text-row">有此人,咸來問訊。<span class="wst-side-annotation-box"><span class="wst-side-delimiter">〈</span><span class="wst-side-annotation-row">第一行注釋</span><span class="wst-side-annotation-row">第二行整行的注釋</span>', {nowiki=1})
end
function p:test_ending()
self:preprocess_equals('{{#invoke:Side annotation|ending}}', '<span class="wst-side-delimiter">〉</span></span></span></span>', {nowiki=1})
self:preprocess_equals('{{#invoke:Side annotation|ending|第三行注釋}}', '<span class="wst-side-annotation-row">第三行注釋</span><span class="wst-side-delimiter">〉</span></span></span></span>', {nowiki=1})
end
function p:test_mid()
self:preprocess_equals('{{#invoke:Side annotation|mid|}}', '<span class="wst-side-text-row">', {nowiki=1})
end
return p