mediawiki-extensions-AbuseF.../tests/parserTests/wptest2.t
Huji Lee d07717dd0d Use triple equals in abuse filter parser tests
The only exception is mwexamples-comparisons.t which intentionally
includes examples with = and == to test the "weak" version of the
comparison operator.

Bug: T262063
Change-Id: I6f92aadc69489da481a606bfda89617b8efbb261
2020-10-06 12:29:47 -04:00

22 lines
1.3 KiB
Raku

/* Filter 61 from English Wikipedia (new user removing references) */
user_groups_test := ["*"];
new_size_test := 100;
article_namespace_test := 0;
edit_delta_test := -22;
added_lines_test := ['<ref name="bah">test</ref> test2!'];
removed_lines_test := ['<ref name="bah">test</ref><ref name="wah">test2</ref>'];
!("autoconfirmed" in user_groups_test)
/* this edit_delta ignores large blankings that are treated by another filter */
& edit_delta_test >= -1000
& article_namespace_test == 0
/* No added lines usually mean a blanking which is dealt with by other filter */
& length(added_lines_test) != 0
& !("#redirect" in lcase(added_lines_test))
/*Counts of more reference tags are removed than added */
& (rcount("(<ref>|<ref\sname|</ref>)",removed_lines_test) > rcount("(<ref>|<ref\sname|</ref>)",added_lines_test))
/*Excludes changing to the named reference format and removing closing tags attached to formerly named refs. Unequality is to account for closing the first named tag */
& !(rcount("<ref>",removed_lines_test) === rcount("<ref\sname",added_lines_test) | rcount("</ref>",removed_lines_test) <= rcount("<ref\sname",added_lines_test))
/*Excludes removal of references to Wikipedia itself */
& !(count("http://en.wikipedia.org",string(removed_lines_test)) > count("http://en.wikipedia.org",string(added_lines_test)))