Module:Dates/testcases
Jump to navigation
Jump to search
[[File:|40x40px|alt=|link=]] | This is the test cases page for the module Module:Dates. Results of the test cases. |
local p = require("Module:UnitTests")
function p:test_format_en()
self:preprocess_equals("{{#invoke:Dates|format|2019-03-04}}", "4 Mar")
self:preprocess_equals("{{#invoke:Dates|format|2018-01-01}}", "1 Jan")
self:preprocess_equals("{{#invoke:Dates|format|2018-12-31}}", "31 Dec")
self:preprocess_equals("{{#invoke:Dates|format|2019-03-04|}}", "4 Mar")
self:preprocess_equals("{{#invoke:Dates|format|2019-03-04|2019-03-05}}", "4–5 Mar")
self:preprocess_equals("{{#invoke:Dates|format|2019-03-04|2019-04-01}}", "4 Mar – 1 Apr")
end
function p:test_format_es()
self:preprocess_equals("{{#invoke:Dates|format|lang=es|2019-03-04}}", "4 de mar")
self:preprocess_equals("{{#invoke:Dates|format|lang=es|2019-03-04|2019-03-05}}", "4–5 de mar")
self:preprocess_equals("{{#invoke:Dates|format|lang=es|2019-03-04|2019-04-01}}", "4 de mar – 1 de abr")
end
function p:test_format_ko()
self:preprocess_equals("{{#invoke:Dates|format|lang=ko|2019-03-04}}", "3월4일")
self:preprocess_equals("{{#invoke:Dates|format|lang=ko|2019-03-04|2019-03-05}}", "3월4일 ~ 5일")
self:preprocess_equals("{{#invoke:Dates|format|lang=ko|2019-03-04|2019-04-01}}", "3월4일 ~ 4월1일")
end
function p:test_format_ja()
self:preprocess_equals("{{#invoke:Dates|format|lang=ja|2019-03-04}}", "3月4日")
self:preprocess_equals("{{#invoke:Dates|format|lang=ja|2019-03-04|2019-03-05}}", "3月4日~5日")
self:preprocess_equals("{{#invoke:Dates|format|lang=ja|2019-03-04|2019-04-01}}", "3月4日~4月1日")
end
function p:test_format_zh()
self:preprocess_equals("{{#invoke:Dates|format|lang=zh|2019-03-04}}", "3月4日")
self:preprocess_equals("{{#invoke:Dates|format|lang=zh|2019-03-04|2019-03-05}}", "3月4日至5日")
self:preprocess_equals("{{#invoke:Dates|format|lang=zh|2019-03-04|2019-04-01}}", "3月4日至4月1日")
end
return p