跳至內容

模組:Footnotes/testcases

Chók-cê̤ṳ Wikipedia

21 tests failed.

test_harv
Text Expected Actual
✓ {{harvard citation|}} ([[#CITEREF|]]) ([[#CITEREF|]])
✓ {{harvard citation|Smith | 2004}} (Smith 2004) (Smith 2004)
✓ {{harvard citation|Smith | Jones | 2004}} (Smith & Jones 2004) (Smith & Jones 2004)
✓ {{harvard citation|Smith | Jones | Brown | 2004}} (Smith, Jones & Brown 2004) (Smith, Jones & Brown 2004)
✓ {{harvard citation|Smith | Jones | Brown | Taylor | 2004}} (Smith et al. 2004) (Smith et al. 2004)
✓ {{harvard citation|Smith | Jones | Brown | Taylor | King | 2004}} (Smith et al.) (Smith et al.)
✓ {{harvard citation|Smith | Jones | 2004 | p=45}} (Smith & Jones 2004, p. 45) (Smith & Jones 2004, p. 45)
✓ {{harvard citation|Smith | Jones | 2004 | page=45}} (Smith & Jones 2004, p. 45) (Smith & Jones 2004, p. 45)
✓ {{harvard citation|Smith | Jones | 2004 | p=45 | page =46}} (Smith & Jones 2004, p. 45) (Smith & Jones 2004, p. 45)
✓ {{harvard citation|Smith | Jones | 2004 | pp=23-57}} (Smith & Jones 2004, pp. 23-57) (Smith & Jones 2004, pp. 23-57)
✓ {{harvard citation|Smith|2006| pp=25–26 | Ref=none}} (Smith 2006, pp. 25–26) (Smith 2006, pp. 25–26)
✓ {{harvard citation|Smith | Jones | 2004 | pages=45-78}} (Smith & Jones 2004, pp. 45-78) (Smith & Jones 2004, pp. 45-78)
✓ {{harvard citation|Smith | Jones | 2004 | pp=23-57 | pages=45-78}} (Smith & Jones 2004, pp. 23-57) (Smith & Jones 2004, pp. 23-57)
✓ {{harvard citation|Smith | Jones | 2004 | pp=23-57 | loc=45-78}} (Smith & Jones 2004, pp. 23-57, 45-78) (Smith & Jones 2004, pp. 23-57, 45-78)
✓ {{harvard citation|Smith | Jones | 2004 | p=23 | loc=45-78}} (Smith & Jones 2004, p. 23, 45-78) (Smith & Jones 2004, p. 23, 45-78)
✓ {{harvard citation|Smith | Jones | 2004 | p=23 | page=45 | pp=23-57 | pages=45-78| location=145-178}} (Smith & Jones 2004, p. 23) (Smith & Jones 2004, p. 23)
✓ {{harvard citation|Smith | Jones | 2004 | loc=Chapter 2}} (Smith & Jones 2004, Chapter 2) (Smith & Jones 2004, Chapter 2)
✓ {{harvard citation|Smith | Jones | Brown | 2004 | ref = none}} (Smith, Jones & Brown 2004) (Smith, Jones & Brown 2004)
✓ {{harvard citation|Smith | Jones | Brown | 2004 | ref = Cream cheese}} (Smith, Jones & Brown 2004) (Smith, Jones & Brown 2004)
✓ {{harvard citation| Smith|2011|loc=[http://en.wikipedia.org chpt 3]}} (Smith 2011, chpt 3) (Smith 2011, chpt 3)
✓ {{harvard citation| 中国 | चीन | 2004}} (中国 & चीन 2004) (中国 & चीन 2004)
✓ {{harvard citation| aiguë | Dütschlünd | 2004}} (aiguë & Dütschlünd 2004) (aiguë & Dütschlünd 2004)
test_harvard_core
Text Expected Actual
test_harvnb
Text Expected Actual
✓ {{harvard citation no brackets|}} [[#CITEREF|]] [[#CITEREF|]]
✓ {{harvard citation no brackets|Smith | 2004}} Smith 2004 Smith 2004
✓ {{harvard citation no brackets|Smith | Jones | 2004}} Smith & Jones 2004 Smith & Jones 2004
✓ {{harvard citation no brackets|Smith | Jones | Brown | 2004}} Smith, Jones & Brown 2004 Smith, Jones & Brown 2004
✓ {{harvard citation no brackets|Smith | Jones | Brown | Taylor | 2004}} Smith et al. 2004 Smith et al. 2004
✓ {{harvard citation no brackets|Smith | Jones | Brown | Taylor | King | 2004}} Smith et al. Smith et al.
✓ {{harvard citation no brackets|Smith | Jones | 2004 | p=45}} Smith & Jones 2004, p. 45 Smith & Jones 2004, p. 45
✓ {{harvard citation no brackets|Smith | Jones | 2004 | page=45}} Smith & Jones 2004, p. 45 Smith & Jones 2004, p. 45
✓ {{harvard citation no brackets|Smith | Jones | 2004 | p=45 | page =46}} Smith & Jones 2004, p. 45 Smith & Jones 2004, p. 45
✓ {{harvard citation no brackets|Smith | Jones | 2004 | pp=23-57}} Smith & Jones 2004, pp. 23-57 Smith & Jones 2004, pp. 23-57
✓ {{harvard citation no brackets|Smith | Jones | 2004 | pages=45-78}} Smith & Jones 2004, pp. 45-78 Smith & Jones 2004, pp. 45-78
✓ {{harvard citation no brackets|Smith | Jones | 2004 | pp=23-57 | pages=45-78}} Smith & Jones 2004, pp. 23-57 Smith & Jones 2004, pp. 23-57
✓ {{harvard citation no brackets|Smith | Jones | 2004 | pp=23-57 | loc=45-78}} Smith & Jones 2004, pp. 23-57, 45-78 Smith & Jones 2004, pp. 23-57, 45-78
✓ {{harvard citation no brackets|Smith | Jones | 2004 | p=23 | loc=45-78}} Smith & Jones 2004, p. 23, 45-78 Smith & Jones 2004, p. 23, 45-78
✓ {{harvard citation no brackets|Smith | Jones | 2004 | p=23 | page=45 | pp=23-57 | pages=45-78| location=145-178}} Smith & Jones 2004, p. 23 Smith & Jones 2004, p. 23
✓ {{harvard citation no brackets|Smith | Jones | 2004 | loc=Chapter 2}} Smith & Jones 2004, Chapter 2 Smith & Jones 2004, Chapter 2
✓ {{harvard citation no brackets|Smith | Jones | Brown | 2004 | ref = none}} Smith, Jones & Brown 2004 Smith, Jones & Brown 2004
✓ {{harvard citation no brackets|Smith | Jones | Brown | 2004 | ref = Cream cheese}} Smith, Jones & Brown 2004 Smith, Jones & Brown 2004
✓ {{harvard citation no brackets| Smith|2011|loc=[http://en.wikipedia.org chpt 3]}} Smith 2011, chpt 3 Smith 2011, chpt 3
✓ {{harvard citation no brackets| 中国 | चीन | 2004}} 中国 & चीन 2004 中国 & चीन 2004
✓ {{harvard citation no brackets| aiguë | Dütschlünd | 2004}} aiguë & Dütschlünd 2004 aiguë & Dütschlünd 2004
test_sfn
Text Expected Actual
✗ {{sfn|}} [1] [1]
✗ {{sfn|Smith | 2004}} [2] [2]
✗ {{sfn|Smith | Jones | 2004}} [3] [3]
✗ {{sfn|Smith | Jones | Brown | 2004}} [4] [4]
✗ {{sfn|Smith | Jones | Brown | Taylor | 2004}} [5] [5]
✗ {{sfn|Smith | Jones | Brown | Taylor | King | 2004}} [6] [6]
✗ {{sfn|Smith | Jones | 2004 | p=45}} [7] [7]
✗ {{sfn|Smith | Jones | 2004 | page=45}} [7] [7]
✗ {{sfn|Smith | Jones | 2004 | p=45 | page =46}} [7] [7]
✗ {{sfn|Smith | Jones | 2004 | pp=23-57}} [8] [8]
✗ {{sfn|Smith | Jones | 2004 | pages=45-78}} [9] [9]
✗ {{sfn|Smith | Jones | 2004 | pp=23-57 | pages=45-78}} [8] [8]
✗ {{sfn|Smith | Jones | 2004 | pp=23-57 | loc=45-78}} [10] [10]
✗ {{sfn|Smith | Jones | 2004 | p=23 | loc=45-78}} [11] [11]
✗ {{sfn|Smith | Jones | 2004 | p=23 | page=45 | pp=23-57 | pages=45-78| location=145-178}} [12] [12]
✗ {{sfn|Smith | Jones | 2004 | loc=Chapter 2}} [13] [13]
✗ {{sfn|Smith | Jones | Brown | 2004 | ref = none}} [4] [4]
✗ {{sfn|Smith | Jones | Brown | 2004 | ref = Cream cheese}} [4] [4]
✗ {{sfn| Smith|2011|loc=[http://en.wikipedia.org chpt 3]}} [14] [14]
✗ {{sfn| 中国 | चीन | 2004}} [15] [15]
✗ {{sfn| aiguë | Dütschlünd | 2004}} [16] [16]


  1. 1.0 1.1 [[#CITEREF|]].
  2. 2.0 2.1 Smith 2004.
  3. 3.0 3.1 Smith & Jones 2004.
  4. 4.0 4.1 4.2 4.3 4.4 4.5 Smith, Jones & Brown 2004. Īng-ê̤ṳng chó̤-nguô: 無效的<ref>標籤;name屬性“FOOTNOTESmithJonesBrown2004”使用不同內容定義了多次
  5. 5.0 5.1 Smith et al. 2004.
  6. 6.0 6.1 Smith et al.
  7. 7.0 7.1 7.2 7.3 7.4 7.5 Smith & Jones 2004, p. 45.
  8. 8.0 8.1 8.2 8.3 Smith & Jones 2004, pp. 23-57.
  9. 9.0 9.1 Smith & Jones 2004, pp. 45-78.
  10. 10.0 10.1 Smith & Jones 2004, pp. 23-57, 45-78.
  11. 11.0 11.1 Smith & Jones 2004, p. 23, 45-78.
  12. 12.0 12.1 Smith & Jones 2004, p. 23.
  13. 13.0 13.1 Smith & Jones 2004, Chapter 2.
  14. 14.0 14.1 Smith 2011, chpt 3.
  15. 15.0 15.1 中国 & चीन 2004.
  16. 16.0 16.1 aiguë & Dütschlünd 2004.

-- Unit tests for [[Module:Citation]]. Click talk page to run tests.
local p = require('Module:UnitTests')

function p:test_harvnb()
    self:preprocess_equals_preprocess_many('{{harvard citation no brackets|', '}}', '{{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|', '}}', '{{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|', '}}', '{{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|', '}}', '{{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.&nbsp;" },
        { "P1 = Smith | P2 = Jones | P3 = 2004 | Pages=23-57| REF = ABC | PagesSep=, pp.&nbsp;" },
        { "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.&nbsp;" },
        { "P1 = Smith | P2 = Jones | P3 = 2004 | Page=45 | Pages=45-78| Location=145-178 | REF = ABC| PageSep=, p.&nbsp;| PagesSep=, pp.&nbsp;" },
        { "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;