Module:Lang/testcases explained

local p = require('Module:UnitTests')

--

= < L A N G _ T E S T S >

=

--italic= with values:- 'yes',- 'no',- 'invert',- 'italic',- present but not set,- invalid 'whatever',- parameter not present.

|italic=yes or |italic=no overrides every other parameter that might set the rendered text's font.

function p:test_01_lang_italic self:preprocess_equals_preprocess_many('', '', ,) self:preprocess_equals_preprocess('', '', )end

--italic=yes and |italic=no when |script=arab or |script=latn is set.

|italic=yes should override whatever |script= might say.

The value assigned to |script= shall be appended to the language code; for |script=arab the module shall adddir="rtl" to the text's enclosing

and insert the ‎ marker.

function p:test_02_lang_italic_with_script self:preprocess_equals_preprocess_many('', '', ,) self:preprocess_equals_preprocess_many('', '', ,)end

--rtl= with values 'yes', 'no', present but not set, and the invalid 'whatever'.There is a separate test for the parameter not present.

|rtl=yes adds dir="rtl" to the text's enclosing

and inserts the ‎ marker.

function p:test_03_lang_rtl self:preprocess_equals_preprocess_many('', '', ,) self:preprocess_equals_preprocess('', '', )end

--code= with values that should not produce error messages: 'de', 'de-ch', 'de-CH-1901', 'ru-RU-petr1708', '1ca', es-419.

function p:test_04_lang_ietf self:preprocess_equals_preprocess_many('', '', ,)end

--italic=invert set.

function p:test_05_lang_invert_italics self:preprocess_equals_preprocess_many('', '', ,)end

--

= < L A N G _ X X _ T E S T S >

=

--italic=yes or |italic=no overrides every other parameter that might set the rendered text's font.

function p:test_06_lang_xx_italic self:preprocess_equals_preprocess_many('', '', ,) self:preprocess_equals_preprocess('', '', )end

--italic=yes and |italic=no when |script=arab or |script=latn is set.

|italic=yes should override whatever |script= might say.

The value assigned to |script= shall be appended to the language code; for |script=arab the module shall adddir="rtl" to the text's enclosing

and insert the ‎ marker.

function p:test_07_lang_xx_italic_with_script self:preprocess_equals_preprocess_many('', '', ,) self:preprocess_equals_preprocess_many('', '', ,)end

--script=arab and |script=latn with |italic= preset but not set and |italic= not present.

|script=arab shall not italicize text.|script=latn shall italicize text.

The value assigned to |script= shall be appended to the language code; for |script=arab the module shall adddir="rtl" to the text's enclosing

and insert the ‎ marker.

There is no version of this test because has no need for separate |script=, |region=, and |variant=parameters - those subtags can all be added to the IETF language code in the template's first positional parameter .

function p:test_08_lang_xx_script self:preprocess_equals_preprocess_many('', '', ,) self:preprocess_equals_preprocess_many('', '', ,)end

--rtl= with values 'yes', 'no', present but not set, and the invalid 'whatever'.There is a separate test for the parameter not present.

|rtl=yes adds dir="rtl" to the text's enclosing

and inserts the ‎ marker.

function p:test_09_lang_xx_rtl self:preprocess_equals_preprocess_many('', '', ,) self:preprocess_equals_preprocess('', '', )end

----------------------------< L A N G _ T R A N S L I T >------------------------------------------------------------------------

Tests various supported combinations of translit formats.

function p:test_10_lang_xx_translit self:preprocess_equals_preprocess_many('', '', ,)end

--link= and |label= combinations.

function p:test_11_lang_xx_link_and_label self:preprocess_equals_preprocess_many('', '', ,)end

--italic=invert set.

function p:test_12_lang_xx_invert_italics self:preprocess_equals_preprocess_many('', '', ,)end

--

= < T R A N S L _ T E S T S >

=

---------------------------- < T R A N S L _ F O R M A T S > --------------------------

Tests various supported combinations of translit formats.

function p:test_13_transl_formats self:preprocess_equals_preprocess_many('', '', ,)end

--italic= with values 'yes', 'no', present but not set, default, unset, and the invalid 'whatever'.There is a separate test for the parameter not present.

function p:test_14_transl_italics self:preprocess_equals_preprocess_many('', '', ,)end

--

= < C A T E G O R Y _ F R O M _ T A G _ T E S T S >

=

--

function p:test_15_category_from_tag self:preprocess_equals_preprocess_many('', '', )end

--

= < N A M E _ F R O M _ T A G _ T E S T S >

=

--

function p:test_16_name_from_tag self:preprocess_equals_preprocess_many('', '', )end

--

= < T A G _ F R O M _ N A M E _ T E S T S >

=

--

function p:test_17_tag_from_name self:preprocess_equals_preprocess_many('', '', )end

--

= < I S _ I E T F _ T A G _ T E S T S >

=

---------------------------- < I S _ I E T F _ T A G > --------------------------

Returns true if valid IETF tag.

function p:test_18_is_ietf_tag self:preprocess_equals_preprocess_many('', '', )end

--

= < I S _ L A N G _ N A M E _ T E S T S >

=

---------------------------- < I S _ L A N G _ N A M E > --------------------------

Returns true if valid language name.

function p:test_19_is_lang_name self:preprocess_equals_preprocess_many('', '', )end

--

= < E R R O R S >

=

----------------------------< L A N G _ E R R O R S >------------------------------------------------------------------------

Lang errors.

function p:test_20_lang_errors self:preprocess_equals_preprocess_many('', '', ,)end

---------------------------- < L A N G _ X X _ E R R O R S > --------------------------

Lang-xx errors.

function p:test_21_lang_xx_errors self:preprocess_equals_preprocess_many('', '', ,)end

---------------------------- < T R A N S L _ E R R O R S > --------------------------

Transl errors.

function p:test_22_transl_errors self:preprocess_equals_preprocess_many('', '', ,)end

---------------------------- < C A T E G O R Y _ F R O M _ T A G _ E R R O R S > --------------------------

category_from_tag errors.

function p:test_23_category_from_tag_errors self:preprocess_equals_preprocess_many('', '', ,)end

--

function p:test_24_name_from_tag_errors self:preprocess_equals_preprocess_many('', '', ,)end

--

function p:test_25_tag_from_name_errors self:preprocess_equals_preprocess_many('', '', ,)end

---------------------------- < H T M L _ T A G _ S E L E C T > --------------------------

html_tag_select errors.

function p:test_26_html_tag_select implied_para_content = Text with...

implied paragraph breaks.

self:preprocess_equals_preprocess_many('', '', ,)end

return p