mediawiki-extensions-AbuseF.../tests/parserTests/wptest2.t
Marius Hoch 35747761fb Allow running the AbuseFilter parser tests via phpunit
I've also added myself to the credits file as I'm the only
maintainer of this extension for a while now.

Change-Id: Id998172ea2abd70b8243de9db1a96cc2cfa47a64
2013-07-08 19:22:43 +02: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)))