Module:Citation/CS1/testcases/local

Documentation for this module may be created at Module:Citation/CS1/testcases/local/doc

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

function p:test()
    self:preprocess_equals(
    	'{{cite book | last=Miller |first=E. | year=2005 | title=The Sun | publisher=Academic Press |location=New York }}', 
    	'<cite id="CITEREFMiller2005" class="citation book cs1">Miller, E. (2005). <i>The Sun</i>. New York: Academic Press.</cite>', 
    	{nowiki=false, templatestyles=true, combined=true, stripmarker=false}
    )
end
function p:test_t()
    self:preprocess_equals(
    	'{{cite book | last=Miller |first=E. | year=2005 | title=The Sun | publisher=Academic Press |location=New York }}', 
    	'<cite id="CITEREFMiller2005" class="citation book cs1">Miller, E. (2005). <i>The Sun</i>. New York: Academic Press.</cite>', 
    	{nowiki=false, templatestyles=true, combined=true, stripmarker=true}
    )
end

function p:test_book()
	self:preprocess_equals_many('{{cite book|', '}}', {
	    {'last=Rose |first=Herbert Jennings |author-link=H.J. Rose |title=A Handbook of Greek Mythology |edition=1st |year=1959 |publisher=E.P. Dutton & Co. |location=New York |language= |isbn=0-525-47041-7 |pages=173', 
	    	'Rose, Herbert Jennings (1959). A Handbook of Greek Mythology (1st leid.). New York: E.P. Dutton & Co. p. 173. ISBN 0-525-47041-7.'},
	    {"last=Miller |first=E. | year=2005 | title=The Sun | publisher=Academic Press |location=New York", 
	    	'<cite id="CITEREFMiller2005" class="citation book cs1">Miller, E. (2005). <i>The Sun</i>. New York: Academic Press.</cite>'},
	}, {nowiki=false, templatestyles=false, stripmarker=true})
end

function p:test__sandbox_book()
	self:preprocess_equals_many('{{cite book/sandbox|', '}}', {
	    {'last=Rose |first=Herbert Jennings |author-link=H.J. Rose |title=A Handbook of Greek Mythology |edition=1st |year=1959 |publisher=E.P. Dutton & Co. |location=New York |language= |isbn=0-525-47041-7 |pages=173', 
	    	'Rose, Herbert Jennings (1959). A Handbook of Greek Mythology (1st leid.). New York: E.P. Dutton & Co. p. 173. ISBN 0-525-47041-7.'},
	}, {nowiki=false, templatestyles=false})
end

return p