Module:LDSverse/testcases

-- Unit tests for Module:LDSVerse. Click talk page to run tests.

-- NB: If you ever see a failure on the results page even though the text seems like it's --	*exactly* the same as what was expected but it still tells you there's a --	difference, check the underscore situation. The LDSverse module does not use --	underscores between words when generating the cross-wiki link (except for in --	#bookmarks, where they are required for the bookmark to work) so if the --	test case here expects there to be underscores in the generated link (e.g., --	Gen.) it will throw an error because the --	link generated by the module will just be Gen.. --	This is really annoying to debug because by the time MediaWiki generates the --	HTML that you see on the results page, it has in fact swapped in underscores --	for those spaces! But that is what is going on. FYI :)

local p = require('Module:UnitTests')

-- No parameters unit test function p:test_01_noParams self:preprocess_equals('', 'LDS Standard Works') end

-- One parameter function p:test_02_noParams2 self:preprocess_equals('', 'Display Text') end

-- Cite to book in Bible function p:test_03_genesis self:preprocess_equals('', 'Gen.') end

-- Cite to (other) book in Bible #1 function p:test_04_sos1 self:preprocess_equals('', 'The Songs of Solomon') end

-- Cite to (other) book in Bible #2 function p:test_05_sos2 self:preprocess_equals('', 'Canticles') end

-- Cite to Bible chapter #1 function p:test_06_num_3 self:preprocess_equals('', 'Num. 3') end

-- Cite to Bible chapter #2 function p:test_07_1_kings_5 self:preprocess_equals('', '1 Kuningad 5') end

-- Cite to Bible chapter #3 function p:test_08_amos_2 self:preprocess_equals('', 'Amos (not Andy) 2') end

-- Cite to Bible verse #1 function p:test_09_gen_3_6 self:preprocess_equals('', 'Gen. 3:6') end

-- Cite to Bible verse #2 function p:test_10_matt_5_20 self:preprocess_equals('', 'Matt. 5:20') end

-- Cite to BoM book #1 function p:test_11_mormon self:preprocess_equals('', 'Morm.') end

-- Cite to BoM book #2 function p:test_12_enos self:preprocess_equals('', 'Enos da Man') end

-- Cite to BoM book #3 function p:test_13_1_ne self:preprocess_equals('', 'Morm.') end

-- Cite to BoM chapter #1 function p:test_14_2_ne_26 self:preprocess_equals('', '2 Nyafi 26') end

-- Cite to BoM chapter #2 function p:test_15_alma_50 self:preprocess_equals('', 'Alma 50') end

-- Cite to BoM verse #1 function p:test_16_2_ne_26_33 self:preprocess_equals('', '2 Nyafi 26:33') end

-- Cite to D&C function p:test_17_dc self:preprocess_equals('', 'D&C') end

-- Cite to D&C Section function p:test_18_dc_88 self:preprocess_equals('', 'D&C 88') end

-- Cite to D&C verse function p:test_19_dc_88_6 self:preprocess_equals('', 'D&C 88:6') end

-- Cite to PoGP book 1 function p:test_20_jst_matthew self:preprocess_equals('', 'JST Matthew') end

-- Cite to PoGP book 2 function p:test_21_abraham self:preprocess_equals('', 'Avraham (Gileadi)') end

-- Cite to PoGP book 3 function p:test_22_moses self:preprocess_equals('', 'Moses') end

-- Cite to PoGP book 4 function p:test_23_history self:preprocess_equals('', 'JS History') end

-- Cite to PoGP book 5 function p:test_24_aof self:preprocess_equals('', 'AoF') end

-- Cite to PoGP chapter 1 function p:test_25_moses_2 self:preprocess_equals('', 'Moses 2') -- This assumes that PoGP chapter bookmarks get standardized end

-- Cite to PoGP chapter 2 function p:test_26_abraham_3 self:preprocess_equals('', 'Abr. 3') -- This assumes that PoGP chapter bookmarks get standardized end

-- Cite to PoGP chapter 3 function p:test_27_aof_1 self:preprocess_equals('', 'AoF 1') -- This assumes that PoGP chapter bookmarks get standardized end

-- Cite to PoGP chapter 4 function p:test_28_jst_matthew_1 self:preprocess_equals('', 'JS Matthew 1') -- This assumes that PoGP chapter bookmarks get standardized end

-- Cite to PoGP chapter 5 function p:test_29_js_history_1 self:preprocess_equals('', 'JS Hist. 1') -- This assumes that PoGP chapter bookmarks get standardized end

-- Cite to PoGP verse 1 function p:test_30_moses_3_8 self:preprocess_equals('', 'Moses 3:8') end

-- Cite to PoGP verse 2 function p:test_31_abraham_3_8 self:preprocess_equals('', 'Abr. 3:8') end

-- Cite to PoGP verse 3 function p:test_32_jst_matthew_26 self:preprocess_equals('', 'JST Matthew 1:26') end

-- Cite to PoGP verse 4 function p:test_33_jst_hist_16 self:preprocess_equals('', 'JST Historia 1:16') end

-- Cite to PoGP verse 5 function p:test_34_aof_11 self:preprocess_equals('', 'Articles o\' Faith 1:11') end

-- weird spacing issues function p:test_35_spacing_1 self:preprocess_equals('', 'Alma 7:11') end

-- weird spacing issues function p:test_36_spacing_2 self:preprocess_equals('', 'Mos. 4:16') end

-- range of verses function p:test_37_range_1 self:preprocess_equals('', 'Doctrine + Covenants 128:19–22') end

-- range of verses function p:test_38_range_2 self:preprocess_equals('', 'Doctrine + Covenants 128:19–22, 24') end

-- BoM intro function p:test_39_bom_title_page self:preprocess_equals('', 'Title Page to the Book of Mormon') end

-- BoM 3 witnesses function p:test_40_bom_3_witnesses self:preprocess_equals('', '3 Witnesses') end

-- BoM 8 witnesses function p:test_41_bom_8_witnesses self:preprocess_equals('', '8 Witnesses') end

-- Lectures on Faith function p:test_42_Lectures self:preprocess_equals('', 'Lectures re Faith') end

-- Lectures on Faith function p:test_43_Lecture_Seventh self:preprocess_equals('', 'Lectures about Faith 7') end

-- Forgotten second parameter --		It's easy to forget to "repeat" the second parameter for the book name, especially if you use --		the full book name as the display text, so these next tests check for a fix for that function p:test_44_forgotten_2nd_param_1 self:preprocess_equals('', 'Alma 7') end

-- Forgotten second parameter function p:test_45_forgotten_2nd_param_2 self:preprocess_equals('', 'Alma 7:11') end

-- Forgotten second parameter function p:test_46_forgotten_2nd_param_3 self:preprocess_equals('', 'Alma 7:11–13, 23–24') end

-- Forgotten second parameter and abbreviation in displayText function p:test_47_forgotten_2nd_param_4 self:preprocess_equals('', '2 Ne. 4:28–30') end

-- Graceful error handling for bad LoF numbers function p:test_48_bad_lof_param self:preprocess_equals('', 'Lectures about Faith 8 (invalid)') end

return p