Module:Citation/CS1/testcases/identifiers explained

--[=[ Unit tests for [[Module:Citation/CS1/Identifiers]].

Click talk page to run tests.

]=]

local p = require('Module:UnitTests');local live_cfg = mw.loadData ('Module:Citation/CS1/Configuration');local new_cfg = mw.loadData ('Module:Citation/CS1/Configuration/sandbox');

--

local function today_plus_offset_get (format, offset) return mw.getContentLanguage:formatDate(format, 'today ' .. offset and ('+ ' .. offset) or );end

----------------------------< A R X I V _ 9 1 0 7 _ 0 7 0 3 >------------------------------------------------

function p:test_arxiv_9107_0703 self:preprocess_equals_preprocess_many('Title . ', 'Book: Title . ', , )end

----------------------------< A R X I V _ 0 7 0 4 _ 1 4 1 2 >------------------------------------------------

function p:test_arxiv_0704_1412 self:preprocess_equals_preprocess_many('Title . ', 'Book: Title . ', , )end

----------------------------< A R X I V _ 1 5 0 1 >----------------------------------------------------------

function p:test_arxiv_1501 self:preprocess_equals_preprocess_many('Title . ', 'Book: Title . ', , )end

----------------------------< A S I N >----------------------------------------------------------------------

function p:test_asin self:preprocess_equals_preprocess_many('Title . ', 'Book: Title . ', , )end

----------------------------< B I B C O D E >----------------------------------------------------------------

function p:test_bibcode local this_year = today_plus_offset_get ('Y', '0 year'); -- get this year self:preprocess_equals_preprocess_many('Title . ', 'Book: Title . ', , )end

----------------------------< B I O R X I V >----------------------------------------------------------------

function p:test_biorxiv local today = today_plus_offset_get ('Y.m.d', '0 year'); self:preprocess_equals_preprocess_many('Title . ', 'Book: Title . ', , )end

----------------------------< C I T E S E E R X >------------------------------------------------------------

function p:test_citeseerx self:preprocess_equals_preprocess_many('Title . ', 'Book: Title . ', , )end

----------------------------< D O I >------------------------------------------------------------------------

function p:test_doi self:preprocess_equals_preprocess_many('Title . ', 'Book: Title . ', , )end

----------------------------< H D L >------------------------------------------------------------------------

function p:test_hdl self:preprocess_equals_preprocess_many('Title . ', 'Book: Title . ', , )end

----------------------------< T E S T _ I S B N >------------------------------------------------------------

function p:test_isbn self:preprocess_equals_preprocess_many('Title . ', 'Book: Title . ', , )end

----------------------------< T E S T _ I S M N >------------------------------------------------------------

function p:test_ismn self:preprocess_equals_preprocess_many('Title . ', 'Book: Title . ', , )end

----------------------------< T E S T _ I S S N >------------------------------------------------------------

function p:test_issn self:preprocess_equals_preprocess_many('Title . ', 'Book: Title . ', , )end

----------------------------< T E S T _ J F M >--------------------------------------------------------------

function p:test_jfm self:preprocess_equals_preprocess_many('Title . ', 'Book: Title . ', , )end

----------------------------< T E S T _ L C C N >------------------------------------------------------------

function p:test_lccn self:preprocess_equals_preprocess_many('Title . ', 'Book: Title . ', , )end

----------------------------< T E S T _ M R >----------------------------------------------------------------

function p:test_mr self:preprocess_equals_preprocess_many('Title . ', 'Book: Title . ', , )end

----------------------------< T E S T _ O C L C >------------------------------------------------------------

function p:test_oclc self:preprocess_equals_preprocess_many('Title . ', 'Book: Title . ', , )end

----------------------------< T E S T _ O L >----------------------------------------------------------------

function p:test_ol self:preprocess_equals_preprocess_many('Title . ', 'Book: Title . ', , )end

----------------------------< T E S T _ P M C >--------------------------------------------------------------

function p:test_pmc local limit = live_cfg.id_handlers['PMC'].id_limit self:preprocess_equals_preprocess_many('Title . ', 'Book: Title . ', , ) limit = new_cfg.id_handlers['PMC'].id_limit; -- get samdbox limit self:preprocess_equals_preprocess_many('Sandbox limit test . ', 'Book: Sandbox limit test . ', , )end

----------------------------< T E S T _ P M I D >------------------------------------------------------------

function p:test_pmid local limit = live_cfg.id_handlers['PMID'].id_limit self:preprocess_equals_preprocess_many('Title . ', 'Book: Title . ', , )

limit = new_cfg.id_handlers['PMID'].id_limit; -- get samdbox limit self:preprocess_equals_preprocess_many('Sandbox limit test . ', 'Book: Sandbox limit test . ', , )end

----------------------------< T E S T _ Q I D >--------------------------------------------------------------

function p:test_qid self:preprocess_equals_preprocess_many('Title . Journal . ', 'Title . Journal . ', , )end

----------------------------< T E S T _ S 2 C I D >----------------------------------------------------------

function p:test_s2cid local limit = live_cfg.id_handlers['S2CID'].id_limit self:preprocess_equals_preprocess_many('Title . ', 'Book: Title . ', , )

limit = new_cfg.id_handlers['S2CID'].id_limit self:preprocess_equals_preprocess_many('Sandbox limit test . ', 'Book: Sandbox limit test . ', , )end

----------------------------< T E S T _ S B N >--------------------------------------------------------------

function p:test_sbn self:preprocess_equals_preprocess_many('Title . ', 'Book: Title . ', , )end

----------------------------< T E S T _ S S R N >------------------------------------------------------------

function p:test_ssrn local limit = live_cfg.id_handlers['SSRN'].id_limit self:preprocess_equals_preprocess_many('Title . ', 'Book: Title . ', , ) limit = new_cfg.id_handlers['SSRN'].id_limit self:preprocess_equals_preprocess_many('Sandbox limit test . ', 'Book: Sandbox limit test . ', , )end

----------------------------< T E S T _ M E S S A G E - I D >------------------------------------------------

function p:test_message_id self:preprocess_equals_preprocess_many('Title . ', 'Title . ', , )end

----------------------------< T E S T _ Z B L >--------------------------------------------------------------

function p:test_zbl self:preprocess_equals_preprocess_many('Title . ', 'Title . ', , )end

----------------------------< T E S T _ A U T O _ L I N K >----------------------------------------

function p:test_auto_link self:preprocess_equals_preprocess_many('Title . free . ', 'Book: Title . free . ', , );

self:preprocess_equals_preprocess_many('Title . Journal . ', 'Title . Journal . ', , )end

----------------------------< T E S T _ A C C E S S _ I C O N S >--------------------------------------------

function p:test_access_icons self:preprocess_equals_preprocess_many('Title . ', 'Book: Title . ', , )end

----------------------------< T E S T _ A C C E P T _ A S _ W R I T T E N >----------------------------------

function p:test_accept_as_written self:preprocess_equals_preprocess_many('Title . ', 'Book: Title . ', , )end

return p