Module:Hani-sortkey/testcases
- The following documentation is located at Module:Hani-sortkey/testcases/documentation. [edit] Categories were auto-generated by Module:module categorization. [edit]
- Useful links: root page • root page’s subpages • links • transclusions • tested module • sandbox
All tests passed. (refresh)
Text | Expected | Actual | |
---|---|---|---|
PS/2接口 (pì-áisi èr jiēkǒu) | PS/2手08口00 | PS/2手08口00 | |
命裡有時終須有,命裡無時莫強求/命里有时终须有,命里无时莫强求 (mìng lǐ yǒu shí zhōngxū yǒu, mìng lǐ wú shí mò qiǎngqiú) | 口05衣07月02日06糸05頁03月02,口05衣07火08日06艸07弓08水02 | 口05衣07月02日06糸05頁03月02,口05衣07火08日06艸07弓08水02 | |
⿱𡩧⿺進⿰貝招/⿱𡩧⿺进⿰贝招 (zhāocáijìnbǎo) | 宀37 | 宀37 |
local tests = require("Module:UnitTests")
local makeSortKey = require("Module:Hani-sortkey").makeSortKey
local full_link = require("Module:links").full_link
local zh = require("Module:languages").getByCode("zh")
local function link(str)
return full_link{ term = str, lang = zh }
end
local function code(str)
return '<code>' .. str .. '</code>'
end
local options = { display = code }
function tests:check(example, expected)
self:equals(link(example),
makeSortKey(example),
expected,
options)
end
function tests:test()
local examples = {
{ "PS/2接口", "PS/2手08口00" },
{ "命裡有時終須有,命裡無時莫強求", "口05衣07月02日06糸05頁03月02,口05衣07火08日06艸07弓08水02" },
{ "⿱𡩧⿺進⿰貝招", "宀37" },
}
self:iterate(examples, "check")
end
return tests