mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter.git
synced 2024-11-24 14:13:54 +00:00
8cfd527f31
Some of them are actually too simple, and may be unuseful in tricky situations. This patch adds a lot of test cases to provide an (almost) bombproof safety with future patches. Depends-On: I0bb1ed0109af66997e238b532d342d82d4c4ae19 Change-Id: I274ef306775c36be20acb662353f6537ff3f1a33
22 lines
1.1 KiB
Perl
22 lines
1.1 KiB
Perl
/* Examples from [[mw:Extension:AbuseFilter/Rules format#Functions]] */
|
||
|
||
length( "Wikipedia" ) === 9 &
|
||
lcase( "WikiPedia" ) === 'wikipedia' &
|
||
ccnorm( "w1k1p3d14" ) === 'WIKIPEDIA' &
|
||
ccnorm( "ωɨƙɩᑭƐƉ1α" ) === 'WIKIPEDIA' &
|
||
ccnorm_contains_any( "w1k1p3d14", "wiKiP3D1A", "foo", "bar" ) === true &
|
||
ccnorm_contains_any( "w1k1p3d14", "foo", "bar", "baz" ) === false &
|
||
ccnorm_contains_any( "w1k1p3d14 is 4w3s0me", "bar", "baz", "some" ) === true &
|
||
ccnorm( "ìíîïĩїį!ľ₤ĺľḷĿ" ) === 'IIIIIII!LLLLLL' &
|
||
norm( "!!ω..ɨ..ƙ..ɩ..ᑭᑭ..Ɛ.Ɖ@@1%%α!!" ) === 'WIKIPEDAIA' &
|
||
norm( "F00 B@rr" ) === 'FOBAR' &
|
||
rmdoubles( "foobybboo" ) === 'fobybo' &
|
||
specialratio( "Wikipedia!" ) === 0.1 &
|
||
count( "foo", "foofooboofoo" ) === 3 &
|
||
count( "foo,bar,baz" ) === 3 &
|
||
rmspecials( "FOOBAR!!1" ) === 'FOOBAR1' &
|
||
rescape( "abc* (def)" ) === 'abc\* \(def\)' &
|
||
str_replace( "foobarbaz", "bar", "-" ) === 'foo-baz' &
|
||
ip_in_range( "127.0.10.0", "127.0.0.0/12" ) === true &
|
||
contains_any( "foobar", "x", "y", "f" ) === true &
|
||
get_matches( "(foo?ba+r) is (so+ good)", "fobaaar is soooo good to eat" ) === ['fobaaar is soooo good', 'fobaaar', 'soooo good'] |