Difference between revisions of "Module:Footnotes/testcases"
Jump to navigation
Jump to search
test>Dragons flight |
m (27 revisions imported) |
||
| (3 intermediate revisions by 3 users not shown) | |||
| Line 1: | Line 1: | ||
| − | -- Unit tests for [[Module: | + | -- Unit tests for [[Module:Footnotes]]. Click talk page to run tests. |
local p = require('Module:UnitTests') | local p = require('Module:UnitTests') | ||
| Line 27: | Line 27: | ||
} ) | } ) | ||
end | end | ||
| + | |||
| + | function p:test_sfn() | ||
| + | self:preprocess_equals_preprocess_many('{{sfn/sandbox|', '}}', '{{sfn|', '}}', { | ||
| + | {""}, | ||
| + | { "Smith | 2004" }, | ||
| + | { "Smith | Jones | 2004" }, | ||
| + | { "Smith | Jones | Brown | 2004" }, | ||
| + | { "Smith | Jones | Brown | Taylor | 2004" }, | ||
| + | { "Smith | Jones | Brown | Taylor | King | 2004" }, | ||
| + | { "Smith | Jones | 2004 | p=45" }, | ||
| + | { "Smith | Jones | 2004 | page=45" }, | ||
| + | { "Smith | Jones | 2004 | p=45 | page =46" }, | ||
| + | { "Smith | Jones | 2004 | pp=23-57" }, | ||
| + | { "Smith | Jones | 2004 | pages=45-78" }, | ||
| + | { "Smith | Jones | 2004 | pp=23-57 | pages=45-78" }, | ||
| + | { "Smith | Jones | 2004 | pp=23-57 | loc=45-78" }, | ||
| + | { "Smith | Jones | 2004 | p=23 | loc=45-78" }, | ||
| + | { "Smith | Jones | 2004 | p=23 | page=45 | pp=23-57 | pages=45-78| location=145-178" }, | ||
| + | { "Smith | Jones | 2004 | loc=Chapter 2" }, | ||
| + | { "Smith | Jones | Brown | 2004 | ref = none" }, | ||
| + | { "Smith | Jones | Brown | 2004 | ref = Cream cheese" }, | ||
| + | { " Smith|2011|loc=[http://en.wikipedia.org chpt 3]" }, | ||
| + | { " 中国 | चीन | 2004" }, | ||
| + | { " aiguë | Dütschlünd | 2004" }, | ||
| + | } ) | ||
| + | end | ||
| + | |||
function p:test_harv() | function p:test_harv() | ||
| Line 56: | Line 83: | ||
function p:test_harvard_core() | function p:test_harvard_core() | ||
| + | if nil then | ||
self:preprocess_equals_preprocess_many('{{harvard citation/core/sandbox|', '}}', '{{harvard citation/core|', '}}', { | self:preprocess_equals_preprocess_many('{{harvard citation/core/sandbox|', '}}', '{{harvard citation/core|', '}}', { | ||
{ "" }, | { "" }, | ||
| Line 74: | Line 102: | ||
{ "P1 = Smith | P2 = Jones | P3 = 2004 | REF = ABC | BracketRight=% | BracketLeft=_ | BracketYearRight=@ | BracketYearLeft=^ | Postscript = ..." }, | { "P1 = Smith | P2 = Jones | P3 = 2004 | REF = ABC | BracketRight=% | BracketLeft=_ | BracketYearRight=@ | BracketYearLeft=^ | Postscript = ..." }, | ||
} ) | } ) | ||
| + | end | ||
end | end | ||
return p; | return p; | ||
Latest revision as of 16:28, 6 September 2020
Documentation for this module may be created at Module:Footnotes/testcases/doc
-- Unit tests for [[Module:Footnotes]]. Click talk page to run tests.
local p = require('Module:UnitTests')
function p:test_harvnb()
self:preprocess_equals_preprocess_many('{{harvard citation no brackets/sandbox|', '}}', '{{harvnb|', '}}', {
{""},
{ "Smith | 2004" },
{ "Smith | Jones | 2004" },
{ "Smith | Jones | Brown | 2004" },
{ "Smith | Jones | Brown | Taylor | 2004" },
{ "Smith | Jones | Brown | Taylor | King | 2004" },
{ "Smith | Jones | 2004 | p=45" },
{ "Smith | Jones | 2004 | page=45" },
{ "Smith | Jones | 2004 | p=45 | page =46" },
{ "Smith | Jones | 2004 | pp=23-57" },
{ "Smith | Jones | 2004 | pages=45-78" },
{ "Smith | Jones | 2004 | pp=23-57 | pages=45-78" },
{ "Smith | Jones | 2004 | pp=23-57 | loc=45-78" },
{ "Smith | Jones | 2004 | p=23 | loc=45-78" },
{ "Smith | Jones | 2004 | p=23 | page=45 | pp=23-57 | pages=45-78| location=145-178" },
{ "Smith | Jones | 2004 | loc=Chapter 2" },
{ "Smith | Jones | Brown | 2004 | ref = none" },
{ "Smith | Jones | Brown | 2004 | ref = Cream cheese" },
{ " Smith|2011|loc=[http://en.wikipedia.org chpt 3]" },
{ " 中国 | चीन | 2004" },
{ " aiguë | Dütschlünd | 2004" },
} )
end
function p:test_sfn()
self:preprocess_equals_preprocess_many('{{sfn/sandbox|', '}}', '{{sfn|', '}}', {
{""},
{ "Smith | 2004" },
{ "Smith | Jones | 2004" },
{ "Smith | Jones | Brown | 2004" },
{ "Smith | Jones | Brown | Taylor | 2004" },
{ "Smith | Jones | Brown | Taylor | King | 2004" },
{ "Smith | Jones | 2004 | p=45" },
{ "Smith | Jones | 2004 | page=45" },
{ "Smith | Jones | 2004 | p=45 | page =46" },
{ "Smith | Jones | 2004 | pp=23-57" },
{ "Smith | Jones | 2004 | pages=45-78" },
{ "Smith | Jones | 2004 | pp=23-57 | pages=45-78" },
{ "Smith | Jones | 2004 | pp=23-57 | loc=45-78" },
{ "Smith | Jones | 2004 | p=23 | loc=45-78" },
{ "Smith | Jones | 2004 | p=23 | page=45 | pp=23-57 | pages=45-78| location=145-178" },
{ "Smith | Jones | 2004 | loc=Chapter 2" },
{ "Smith | Jones | Brown | 2004 | ref = none" },
{ "Smith | Jones | Brown | 2004 | ref = Cream cheese" },
{ " Smith|2011|loc=[http://en.wikipedia.org chpt 3]" },
{ " 中国 | चीन | 2004" },
{ " aiguë | Dütschlünd | 2004" },
} )
end
function p:test_harv()
self:preprocess_equals_preprocess_many('{{harvard citation/sandbox|', '}}', '{{harv|', '}}', {
{""},
{ "Smith | 2004" },
{ "Smith | Jones | 2004" },
{ "Smith | Jones | Brown | 2004" },
{ "Smith | Jones | Brown | Taylor | 2004" },
{ "Smith | Jones | Brown | Taylor | King | 2004" },
{ "Smith | Jones | 2004 | p=45" },
{ "Smith | Jones | 2004 | page=45" },
{ "Smith | Jones | 2004 | p=45 | page =46" },
{ "Smith | Jones | 2004 | pp=23-57" },
{ "Smith|2006| pp=25–26 | Ref=none" },
{ "Smith | Jones | 2004 | pages=45-78" },
{ "Smith | Jones | 2004 | pp=23-57 | pages=45-78" },
{ "Smith | Jones | 2004 | pp=23-57 | loc=45-78" },
{ "Smith | Jones | 2004 | p=23 | loc=45-78" },
{ "Smith | Jones | 2004 | p=23 | page=45 | pp=23-57 | pages=45-78| location=145-178" },
{ "Smith | Jones | 2004 | loc=Chapter 2" },
{ "Smith | Jones | Brown | 2004 | ref = none" },
{ "Smith | Jones | Brown | 2004 | ref = Cream cheese" },
{ " Smith|2011|loc=[http://en.wikipedia.org chpt 3]" },
{ " 中国 | चीन | 2004" },
{ " aiguë | Dütschlünd | 2004" },
} )
end
function p:test_harvard_core()
if nil then
self:preprocess_equals_preprocess_many('{{harvard citation/core/sandbox|', '}}', '{{harvard citation/core|', '}}', {
{ "" },
{ "P1 = Smith | P2 = 2004 | REF = ABC" },
{ "P1 = Smith | P2 = Jones | P3 = 2004 | REF = ABC" },
{ "P1 = Smith | P2 = Jones | P3 = Brown | P4 = 2004 | REF = ABC" },
{ "P1 = Smith | P2 = Jones | P3 = Brown | P4 = Taylor | P5 = 2004 | REF=ABC" },
{ "P1 = Smith | P2 = Jones | P3 = Brown | P4 = Taylor | P5 = King | P6 = 2004 | REF=ABC" },
{ "P1 = Smith | P2 = Jones | P3 = 2004 | Page=45 | REF=ABC | PageSep=, p. " },
{ "P1 = Smith | P2 = Jones | P3 = 2004 | Pages=23-57| REF = ABC | PagesSep=, pp. " },
{ "P1 = Smith | P2 = Jones | P3 = 2004 | Location=45-78 | REF = ABC" },
{ "P1 = Smith | P2 = Jones | P3 = 2004 | Page=23 | Location=45-78 | REF= ABC | PageSep=, p. " },
{ "P1 = Smith | P2 = Jones | P3 = 2004 | Page=45 | Pages=45-78| Location=145-178 | REF = ABC| PageSep=, p. | PagesSep=, pp. " },
{ "P1 = Smith | P2 = Jones | P3 = 2004 | Location=Chapter 2 | REF = ABC" },
{ "P1 = Smith | P2 = Jones | P3 = Brown | P4 = 2004 | REF = none" },
{ "P1 = Smith | P2 = Jones | P3 = Brown | P4 = 2004 | REF = Cream cheese" },
{ "P1=Smith| P2 = 2011 | Location=[http://en.wikipedia.org chpt 3] | REF=ABC" },
{ "P1 = Smith | P2 = Jones | P3 = 2004 | REF = ABC | BracketRight=% | BracketLeft=_ | BracketYearRight=@ | BracketYearLeft=^ | Postscript = ..." },
} )
end
end
return p;