Module:Class mask/testcases2

-- Unit tests for quality function of Module:Class mask. Click talk page to run tests. local p = require('Module:UnitTests') local module = mw.getCurrentFrame.args.module or 'Class mask' -- Pages for testing: -- Talk:Oxford spelling has banner shell but no global class -- Talk:James Abbott Thompson is a redirect and has no banner shell -- Talk:Henri-Charles de Beaumanoir of Lavardin has global class unassessed -- Talk:Philippe Cattiau has global class Stub -- Template talk:Germany-silent-film-stub is a template and has global class NA -- Talk:Siege of Arrah has global class A -- Talk:Tropical World is a DAB page and has global class NA -- Template talk:Bombycoidea-stub is a template and has global class NA -- Talk:Christian Coleman has global class C -- Talk:2011 Atlanta Falcons season has global class Start -- Talk:Emma Goldman has global class FA

function p:test_with_inherited_class_Stub self:preprocess_equals_many(, {		{'C', 'XC'},		{'stub', 'HStub'},		{'ddff', 'HStub'},		{, 'HStub'},	}, {nowiki=1}) end

function p:test_with_inherited_class_A self:preprocess_equals_many(, {		{'C', 'XC'},		{'A', 'HA'},		{'ddff', 'HA'},		{, 'HA'},	}, {nowiki=1}) end

function p:test_with_custom_quality_criteria self:preprocess_equals_many('', {		{'Talk:Oxford spelling', 'YC'},		{'Talk:James Abbott Thompson', 'YC'},		{'Talk:Henri-Charles de Beaumanoir of Lavardin', 'YC'},		{'Talk:Philippe Cattiau', 'YC'},		{'Template talk:Germany-silent-film-stub', 'YC'},		{'Talk:Siege of Arrah', 'YC'},	}, {nowiki=1}) end

function p:test_A_class_on_different_pages self:preprocess_equals_many('', {		{'Talk:Oxford spelling', 'YA'},		{'Talk:James Abbott Thompson', 'YA'},		{'Talk:Henri-Charles de Beaumanoir of Lavardin', 'YA'},		{'Talk:Philippe Cattiau', 'XA'},		{'Template talk:Germany-silent-film-stub', 'XA'},		{'Talk:Siege of Arrah', 'HA'},	}, {nowiki=1}) end

function p:test_with_matching_classes self:preprocess_equals('', 'HNA') self:preprocess_equals('', 'HA') self:preprocess_equals('', 'HStub') self:preprocess_equals('', 'H') end

function p:test_for_unassessed self:preprocess_equals('', 'H') self:preprocess_equals('', 'Y') self:preprocess_equals('', 'YNA') end

function p:test_with_valid_article_class_ignoring_namespace self:preprocess_equals_many(, {       {'xyz', 'HFA'},        {'Stub', 'XStub'},        {'Template', 'XNA'},        {, 'HFA'},    }, {nowiki=1}) end

function p:test_with_undefined_class_and_article_class self:preprocess_equals_many(, {       {'xyz', 'Y'},        {'Stub1', 'Y'},        {'dfd', 'Y'},        {, 'Y'},    }, {nowiki=1}) end

function p:test_with_undefined_or_invalid_project_class_ignoring_namespace self:preprocess_equals_many(, {       {'xyz', 'HStart'},        {'Stub1', 'HStart'},        {'dfd', 'HStart'},        {'start', 'HStart'},        {, 'HStart'},        {'B', 'XB'},    }, {nowiki=1}) end

function p:test_non_articles_classes_with_extended_scale_on_dab_page self:preprocess_equals_many(, {       {'NA', 'HNA'},        {'Template', 'HTemplate'},        {'dfd', 'HDisambig'},        {, 'HDisambig'},        {'project', 'HProject'},        {'Start', 'XStart'},        {'dab', 'HDisambig'},    }, {nowiki=1}) end

function p:test_non_articles_classes_ignoring_namespace self:preprocess_equals_many(, {       {'NA', 'HNA'},        {'C', 'XC'},        {'dfd', 'HNA'},        {, 'HNA'},        {'project', 'HNA'},        {'redir', 'HNA'},    }, {nowiki=1}) end

function p:test_subpage_mask self:preprocess_equals_many(, {       {'SL', 'XSL'},        {'c', 'HC'},        {'sausage', 'XTemplate'},        {, 'XTemplate'},        {'fm', 'XFM'},        {'redir', 'XRedirect'},    }, {nowiki=1}) end

function p:test_inline_mask self:preprocess_equals_many('', {       {'Talk:James Abbott Thompson', 'YFuture'},        {'Talk:Henri-Charles de Beaumanoir of Lavardin', 'YFuture'},        {'Talk:Philippe Cattiau', 'XFuture'},        {'Template talk:Germany-silent-film-stub', 'XFuture'},        {'Talk:Siege of Arrah', 'XFuture'},        {'Talk:Tropical World', 'XFuture'},    }, {nowiki=1}) end

function p:test_noprefix self:preprocess_equals_many(, {       {'B', 'B'},        {'Template', 'Template'},        {'dfd', 'A'},        {, 'A'},        {'project', 'Project'},        {'Start', 'Start'},    }, {nowiki=1}) end

function p:test_with_redirect_and_no_inherited_class self:preprocess_equals_many(, {       {, 'YNA'},        {'B', 'YB'},        {'hjfhjh', 'YNA'},        {'NA', 'YNA'},    }, {nowiki=1}) end

return p