diff options
Diffstat (limited to 'AbuseFilter/tests/parserTests')
98 files changed, 213 insertions, 120 deletions
diff --git a/AbuseFilter/tests/parserTests/almost-empty.r b/AbuseFilter/tests/parserTests/almost-empty.r deleted file mode 100644 index 8093d2ab..00000000 --- a/AbuseFilter/tests/parserTests/almost-empty.r +++ /dev/null @@ -1 +0,0 @@ -NOT_MATCH diff --git a/AbuseFilter/tests/parserTests/almost-empty.t b/AbuseFilter/tests/parserTests/almost-empty.t deleted file mode 100644 index e57b08b4..00000000 --- a/AbuseFilter/tests/parserTests/almost-empty.t +++ /dev/null @@ -1 +0,0 @@ -;;;; diff --git a/AbuseFilter/tests/parserTests/arith.r b/AbuseFilter/tests/parserTests/arith.r deleted file mode 100644 index 4736e080..00000000 --- a/AbuseFilter/tests/parserTests/arith.r +++ /dev/null @@ -1 +0,0 @@ -MATCH diff --git a/AbuseFilter/tests/parserTests/arith.t b/AbuseFilter/tests/parserTests/arith.t index 1f88e9df..a0faca87 100644 --- a/AbuseFilter/tests/parserTests/arith.t +++ b/AbuseFilter/tests/parserTests/arith.t @@ -1,3 +1,6 @@ ++1 + -1 === 0 & +-1 + +2 === 1 & +-0 === 0 & (1 + 1 === 2) & (1.5 + 1.5 === 3.0) & (2.5 + 1 === 3.5) & @@ -24,4 +27,4 @@ (2 ** 4 === 16) & (2.5 ** 2 === 6.25) & (2.5 ** 0 === 1.0) & -(1000 ** 0 === 1)
\ No newline at end of file +(1000 ** 0 === 1) diff --git a/AbuseFilter/tests/parserTests/array-assignment.r b/AbuseFilter/tests/parserTests/array-assignment.r deleted file mode 100644 index 4736e080..00000000 --- a/AbuseFilter/tests/parserTests/array-assignment.r +++ /dev/null @@ -1 +0,0 @@ -MATCH diff --git a/AbuseFilter/tests/parserTests/array-assignment.t b/AbuseFilter/tests/parserTests/array-assignment.t index a22294e3..42378a9e 100644 --- a/AbuseFilter/tests/parserTests/array-assignment.t +++ b/AbuseFilter/tests/parserTests/array-assignment.t @@ -1,6 +1,7 @@ -test_array := [ [1, 2], [3, 4] ]; +test_array := [ [1, 2], [3, 4], 'useless' ]; test_array[1] := 42; +test_array[ if true then 2 else 0 end] := 'foo'; test_array[] := 17; -test_array[0][0] == 1 & test_array[0][1] == 2 & test_array[1] == 42 & test_array[2] == 17 +test_array[0][0] == 1 & test_array[0][1] == 2 & test_array[1] == 42 & test_array[2] === 'foo' & test_array[3] == 17 diff --git a/AbuseFilter/tests/parserTests/array-comparisons.r b/AbuseFilter/tests/parserTests/array-comparisons.r deleted file mode 100644 index 4736e080..00000000 --- a/AbuseFilter/tests/parserTests/array-comparisons.r +++ /dev/null @@ -1 +0,0 @@ -MATCH diff --git a/AbuseFilter/tests/parserTests/array-comparisons.t b/AbuseFilter/tests/parserTests/array-comparisons.t index dc6122f5..0d41b89c 100644 --- a/AbuseFilter/tests/parserTests/array-comparisons.t +++ b/AbuseFilter/tests/parserTests/array-comparisons.t @@ -10,6 +10,9 @@ i := [['1', 2], '3']; j := [1]; k := ['1']; l := []; +m := 42; +n := [0,1]; a == b & a === b & a != c & b != d & a == e & a !== e & f == g & f !== g & h == i & h !== i & e != i & j != 1 & -k != '1' & l == false & l == null & l !== false & l !== null & false == l & null == l & false !== l & null !== l +k != '1' & l == false & l == null & l !== false & l !== null & false == l & null == l & false !== l & null !== l & +b[5**2/((4+1)*5)] == a[43-m] & a[n[0]] === b[n[m-42]] diff --git a/AbuseFilter/tests/parserTests/array-statements.t b/AbuseFilter/tests/parserTests/array-statements.t new file mode 100644 index 00000000..7bc7287c --- /dev/null +++ b/AbuseFilter/tests/parserTests/array-statements.t @@ -0,0 +1,3 @@ +/* CachingParser's intEval used to return AFPTreeNode for this */ +var := [1]; +var[0] := 2;
\ No newline at end of file diff --git a/AbuseFilter/tests/parserTests/array-statements2.t b/AbuseFilter/tests/parserTests/array-statements2.t new file mode 100644 index 00000000..5e7479d2 --- /dev/null +++ b/AbuseFilter/tests/parserTests/array-statements2.t @@ -0,0 +1,3 @@ +/* CachingParser's intEval used to return AFPTreeNode for this */ +var := [1]; +var[0] := str_replace('a','b','c');
\ No newline at end of file diff --git a/AbuseFilter/tests/parserTests/array-statements3.t b/AbuseFilter/tests/parserTests/array-statements3.t new file mode 100644 index 00000000..239fbfa4 --- /dev/null +++ b/AbuseFilter/tests/parserTests/array-statements3.t @@ -0,0 +1,3 @@ +/* CachingParser's intEval used to return AFPTreeNode for this - T236870 */ +a := []; +a[] := 2;
\ No newline at end of file diff --git a/AbuseFilter/tests/parserTests/arrays.r b/AbuseFilter/tests/parserTests/arrays.r deleted file mode 100644 index 4736e080..00000000 --- a/AbuseFilter/tests/parserTests/arrays.r +++ /dev/null @@ -1 +0,0 @@ -MATCH diff --git a/AbuseFilter/tests/parserTests/atombraces.r b/AbuseFilter/tests/parserTests/atombraces.r deleted file mode 100644 index f4efce9f..00000000 --- a/AbuseFilter/tests/parserTests/atombraces.r +++ /dev/null @@ -1 +0,0 @@ -NOT MATCH diff --git a/AbuseFilter/tests/parserTests/atombraces.t b/AbuseFilter/tests/parserTests/atombraces.t deleted file mode 100644 index 5bb50190..00000000 --- a/AbuseFilter/tests/parserTests/atombraces.t +++ /dev/null @@ -1 +0,0 @@ -( ) diff --git a/AbuseFilter/tests/parserTests/bool-assoc.r b/AbuseFilter/tests/parserTests/bool-assoc.r deleted file mode 100644 index 4736e080..00000000 --- a/AbuseFilter/tests/parserTests/bool-assoc.r +++ /dev/null @@ -1 +0,0 @@ -MATCH diff --git a/AbuseFilter/tests/parserTests/bug25373.r b/AbuseFilter/tests/parserTests/bug25373.r deleted file mode 100644 index 4736e080..00000000 --- a/AbuseFilter/tests/parserTests/bug25373.r +++ /dev/null @@ -1 +0,0 @@ -MATCH diff --git a/AbuseFilter/tests/parserTests/cast.r b/AbuseFilter/tests/parserTests/cast.r deleted file mode 100644 index 4736e080..00000000 --- a/AbuseFilter/tests/parserTests/cast.r +++ /dev/null @@ -1 +0,0 @@ -MATCH diff --git a/AbuseFilter/tests/parserTests/cast.t b/AbuseFilter/tests/parserTests/cast.t index c0bc317c..e13803d6 100644 --- a/AbuseFilter/tests/parserTests/cast.t +++ b/AbuseFilter/tests/parserTests/cast.t @@ -1 +1,17 @@ -(string(1) === "1") & (int("1") === 1) & (float(1) === 1.0) & bool(1) & !bool(0) +(string(1) === "1") & +(int("1") === 1) & +(float(1) === 1.0) & +bool(1) & !bool(0) & +bool([]) === false & +bool( [false] ) === true & +bool( [1,2,3,4,5,6] ) === true & +float([]) === 0.0 & +float( [false] ) === 1.0 & +float( [1,2,3,4,5,6] ) === 6.0 & +int([]) === 0 & +int( [false] ) === 1 & +int( [1,2,3,4,5,6] ) === 6 & +true + true === 2 & +null - null === 0 & +true * false === 0 & +163 % true === 0 diff --git a/AbuseFilter/tests/parserTests/ccnorm-contains-all.r b/AbuseFilter/tests/parserTests/ccnorm-contains-all.r deleted file mode 100644 index 4736e080..00000000 --- a/AbuseFilter/tests/parserTests/ccnorm-contains-all.r +++ /dev/null @@ -1 +0,0 @@ -MATCH diff --git a/AbuseFilter/tests/parserTests/ccnorm-contains-all.t b/AbuseFilter/tests/parserTests/ccnorm-contains-all.t deleted file mode 100644 index 9a8635c8..00000000 --- a/AbuseFilter/tests/parserTests/ccnorm-contains-all.t +++ /dev/null @@ -1 +0,0 @@ -ccnorm_contains_all("the f00 is on the b4r", "foo", "is on", "bar") diff --git a/AbuseFilter/tests/parserTests/ccnorm-contains-any.r b/AbuseFilter/tests/parserTests/ccnorm-contains-any.r deleted file mode 100644 index 4736e080..00000000 --- a/AbuseFilter/tests/parserTests/ccnorm-contains-any.r +++ /dev/null @@ -1 +0,0 @@ -MATCH diff --git a/AbuseFilter/tests/parserTests/ccnorm-contains-any.t b/AbuseFilter/tests/parserTests/ccnorm-contains-any.t deleted file mode 100644 index 6aeac35c..00000000 --- a/AbuseFilter/tests/parserTests/ccnorm-contains-any.t +++ /dev/null @@ -1 +0,0 @@ -ccnorm_contains_any("like 4ny0ne else", "foo", "aNyon3") & ccnorm_contains_any("street f1ghter","F1ght") diff --git a/AbuseFilter/tests/parserTests/ccnorm.r b/AbuseFilter/tests/parserTests/ccnorm.r deleted file mode 100644 index 4736e080..00000000 --- a/AbuseFilter/tests/parserTests/ccnorm.r +++ /dev/null @@ -1 +0,0 @@ -MATCH diff --git a/AbuseFilter/tests/parserTests/ccnorm.t b/AbuseFilter/tests/parserTests/ccnorm.t deleted file mode 100644 index f233e42e..00000000 --- a/AbuseFilter/tests/parserTests/ccnorm.t +++ /dev/null @@ -1 +0,0 @@ -ccnorm("aany0ne") = "AANYONE" diff --git a/AbuseFilter/tests/parserTests/comment.r b/AbuseFilter/tests/parserTests/comment.r deleted file mode 100644 index 4736e080..00000000 --- a/AbuseFilter/tests/parserTests/comment.r +++ /dev/null @@ -1 +0,0 @@ -MATCH diff --git a/AbuseFilter/tests/parserTests/concatenation.r b/AbuseFilter/tests/parserTests/concatenation.r deleted file mode 100644 index 4736e080..00000000 --- a/AbuseFilter/tests/parserTests/concatenation.r +++ /dev/null @@ -1 +0,0 @@ -MATCH diff --git a/AbuseFilter/tests/parserTests/conditional-shortcircuit.t b/AbuseFilter/tests/parserTests/conditional-shortcircuit.t new file mode 100644 index 00000000..39b2f8ae --- /dev/null +++ b/AbuseFilter/tests/parserTests/conditional-shortcircuit.t @@ -0,0 +1,69 @@ +if ( 1 === 1 ) then +( var1 := 1 ) +else +( var1 := 2 ) +end; + +var2 := 0; +if ( 1 === 1 ) then +( var2 := 1 ) +else +( var2 := 2 ) +end; + +var4 := 'foo'; +if ( 1=== 1 ) then +( var3 := 1; false & ( var4 := 'foobar' ) ) +else +( var3 := 2 ) +end; + +if ( 1 === 1 ) then +( var5 := 1 ) +else +( ( ( var5 := 2 ) ) ) +end; + + +if ( 1 === 1 ) then +( var6 := 1 ) +else +( + if ( 1 == 1 ) then + ( var6 := 2 ) + else + ( var6 := 3 ) + end; +) +end; + + +var7 := 'foo'; +if ( 1=== 1 ) then +(0) +else +( false & ( var7 := 'foobar' ) ) +end; + +var8 := 'foo'; +false & ( + if ( 1 == 1 ) then + (var8 := 3) + else + (var8 := 4) + end; +); + +var9 := 'foo'; +if ( 1=== 1 ) then + ( false & ( var9 := 'foobar' ) ) +end; + +var1 === 1 & +var2 === 1 & +var3 === 1 & +var5 === 1 & +var6 === 1 & +var7 === 'foo' & +var8 === 'foo' & +var9 === 'foo' diff --git a/AbuseFilter/tests/parserTests/contains-all.r b/AbuseFilter/tests/parserTests/contains-all.r deleted file mode 100644 index 4736e080..00000000 --- a/AbuseFilter/tests/parserTests/contains-all.r +++ /dev/null @@ -1 +0,0 @@ -MATCH diff --git a/AbuseFilter/tests/parserTests/contains-all.t b/AbuseFilter/tests/parserTests/contains-all.t index f8b81b24..c3980d13 100644 --- a/AbuseFilter/tests/parserTests/contains-all.t +++ b/AbuseFilter/tests/parserTests/contains-all.t @@ -1 +1,10 @@ -contains_all("the foo is on the bar", "foo", "is on", "bar") & !(contains_all(['foo', 'bar', 'hey'], 'foo', 'bar', 'sup')) & contains_all([1, 2, 3], '1', '2', '3')
\ No newline at end of file +contains_all("the foo is on the bar", "foo", "is on", "bar") & +!(contains_all(['foo', 'bar', 'hey'], 'foo', 'bar', 'sup')) & +contains_all([1, 2, 3], '1', '2', '3') & +contains_all( + 'base', + 'b', + 'a', + 's', + 'e', +) diff --git a/AbuseFilter/tests/parserTests/contains-any.r b/AbuseFilter/tests/parserTests/contains-any.r deleted file mode 100644 index 4736e080..00000000 --- a/AbuseFilter/tests/parserTests/contains-any.r +++ /dev/null @@ -1 +0,0 @@ -MATCH diff --git a/AbuseFilter/tests/parserTests/contains-any.t b/AbuseFilter/tests/parserTests/contains-any.t index 56f1c8bd..fc9445ff 100644 --- a/AbuseFilter/tests/parserTests/contains-any.t +++ b/AbuseFilter/tests/parserTests/contains-any.t @@ -1 +1,4 @@ -contains_any("like anyone else", "else", "someone") & contains_any("street fighter", "fight") & !(contains_any('My foo is cute', 'bar', 'wtf')) & contains_any([[1], [2,3]], 1) +contains_any("like anyone else", "else", "someone") & +contains_any("street fighter", "fight") & +!(contains_any('My foo is cute', 'bar', 'wtf')) & +contains_any([[1], [2,3]], 1) diff --git a/AbuseFilter/tests/parserTests/contains.r b/AbuseFilter/tests/parserTests/contains.r deleted file mode 100644 index f629599c..00000000 --- a/AbuseFilter/tests/parserTests/contains.r +++ /dev/null @@ -1 +0,0 @@ -MATCH
\ No newline at end of file diff --git a/AbuseFilter/tests/parserTests/containsfunction.r b/AbuseFilter/tests/parserTests/containsfunction.r deleted file mode 100644 index f629599c..00000000 --- a/AbuseFilter/tests/parserTests/containsfunction.r +++ /dev/null @@ -1 +0,0 @@ -MATCH
\ No newline at end of file diff --git a/AbuseFilter/tests/parserTests/count.r b/AbuseFilter/tests/parserTests/count.r deleted file mode 100644 index 4736e080..00000000 --- a/AbuseFilter/tests/parserTests/count.r +++ /dev/null @@ -1 +0,0 @@ -MATCH diff --git a/AbuseFilter/tests/parserTests/dundefined-parens.t b/AbuseFilter/tests/parserTests/dundefined-parens.t new file mode 100644 index 00000000..6edf03b4 --- /dev/null +++ b/AbuseFilter/tests/parserTests/dundefined-parens.t @@ -0,0 +1 @@ +false | (var := 'foo')
\ No newline at end of file diff --git a/AbuseFilter/tests/parserTests/dundefined.t b/AbuseFilter/tests/parserTests/dundefined.t new file mode 100644 index 00000000..aac08390 --- /dev/null +++ b/AbuseFilter/tests/parserTests/dundefined.t @@ -0,0 +1 @@ +old_wikitext | true diff --git a/AbuseFilter/tests/parserTests/empty.r b/AbuseFilter/tests/parserTests/empty.r deleted file mode 100644 index 8093d2ab..00000000 --- a/AbuseFilter/tests/parserTests/empty.r +++ /dev/null @@ -1 +0,0 @@ -NOT_MATCH diff --git a/AbuseFilter/tests/parserTests/empty.t b/AbuseFilter/tests/parserTests/empty.t deleted file mode 100644 index e69de29b..00000000 --- a/AbuseFilter/tests/parserTests/empty.t +++ /dev/null diff --git a/AbuseFilter/tests/parserTests/eq.r b/AbuseFilter/tests/parserTests/eq.r deleted file mode 100644 index 4736e080..00000000 --- a/AbuseFilter/tests/parserTests/eq.r +++ /dev/null @@ -1 +0,0 @@ -MATCH diff --git a/AbuseFilter/tests/parserTests/equals-to-any.r b/AbuseFilter/tests/parserTests/equals-to-any.r deleted file mode 100644 index f629599c..00000000 --- a/AbuseFilter/tests/parserTests/equals-to-any.r +++ /dev/null @@ -1 +0,0 @@ -MATCH
\ No newline at end of file diff --git a/AbuseFilter/tests/parserTests/equals-to-any.t b/AbuseFilter/tests/parserTests/equals-to-any.t index e10220ca..c46462af 100644 --- a/AbuseFilter/tests/parserTests/equals-to-any.t +++ b/AbuseFilter/tests/parserTests/equals-to-any.t @@ -1,4 +1,13 @@ equals_to_any( "foo", "bar", "foo", "pizza" ) & equals_to_any( 15, 3, 77, 18, 15 ) & equals_to_any( "", 3, 77, 18, 15, "duh" ) === false & -equals_to_any( "", 3, 77, 18, 15, "duh", "" )
\ No newline at end of file +equals_to_any( "", 3, 77, 18, 15, "duh", "" ) & +equals_to_any( true, 1, "true" ) === false & +equals_to_any( "1", 1, [ 1 ], true ) === false & +equals_to_any( [ 1, "1" ], 1, "1" ) === false & +equals_to_any( [ 1, 2, 3 ], [ 1, 2, 3 ] ) & +equals_to_any( [ 1, 2, 3 ], [ 3, 2, 1 ] ) === false & +equals_to_any( [ "foo", "bar" ], [ ] ) === false & +equals_to_any( [ "foo", "bar" ], [ "foo", "bar" ] ) & +equals_to_any( [], [] ) & +equals_to_any( [ 0 ], [] ) === false diff --git a/AbuseFilter/tests/parserTests/expn.r b/AbuseFilter/tests/parserTests/expn.r deleted file mode 100644 index 4736e080..00000000 --- a/AbuseFilter/tests/parserTests/expn.r +++ /dev/null @@ -1 +0,0 @@ -MATCH diff --git a/AbuseFilter/tests/parserTests/float.r b/AbuseFilter/tests/parserTests/float.r deleted file mode 100644 index 4736e080..00000000 --- a/AbuseFilter/tests/parserTests/float.r +++ /dev/null @@ -1 +0,0 @@ -MATCH diff --git a/AbuseFilter/tests/parserTests/get-matches.r b/AbuseFilter/tests/parserTests/get-matches.r deleted file mode 100644 index f629599c..00000000 --- a/AbuseFilter/tests/parserTests/get-matches.r +++ /dev/null @@ -1 +0,0 @@ -MATCH
\ No newline at end of file diff --git a/AbuseFilter/tests/parserTests/get-matches.t b/AbuseFilter/tests/parserTests/get-matches.t index 88e163b4..45c4ac85 100644 --- a/AbuseFilter/tests/parserTests/get-matches.t +++ b/AbuseFilter/tests/parserTests/get-matches.t @@ -1,4 +1,5 @@ -/* More complete tests for get_matches are in AbuseFilterParserTest.php */ -a := get_matches('I am a (dog|cat)', 'What did you say?'); +get_matches('I am a (dog|cat)', 'What did you say?') === [ false, false ] & get_matches('The (truth|pineapple) is (?:rarely)? pure and (nee*v(ah|er) sh?imple)', 'The truth is rarely pure and never simple, Wilde said') == ['The truth is rarely pure and never simple', 'truth', 'never simple', 'er'] & -a === [false, false]
\ No newline at end of file +get_matches('You say (.*) \(and I say (.*)\)\.', 'You say hello (and I say goodbye).') === [ 'You say hello (and I say goodbye).', 'hello', 'goodbye' ] & +get_matches('I(?: am)? the ((walrus|egg man).*)\!', 'I am the egg man, I am the walrus !') === [ 'I am the egg man, I am the walrus !', 'egg man, I am the walrus ', 'egg man' ] & +get_matches('this (does) not match', 'foo bar') === [ false, false ]
\ No newline at end of file diff --git a/AbuseFilter/tests/parserTests/ifthen.r b/AbuseFilter/tests/parserTests/ifthen.r deleted file mode 100644 index 4736e080..00000000 --- a/AbuseFilter/tests/parserTests/ifthen.r +++ /dev/null @@ -1 +0,0 @@ -MATCH diff --git a/AbuseFilter/tests/parserTests/ifthen.t b/AbuseFilter/tests/parserTests/ifthen.t index c22a3947..ce3e0aa3 100644 --- a/AbuseFilter/tests/parserTests/ifthen.t +++ b/AbuseFilter/tests/parserTests/ifthen.t @@ -1,2 +1,4 @@ (if 1 then 2 else 3 end) === 2 & -(if false then 2 else 3 end) === 3 +(if false then 2 else 3 end) === 3 & +(if true then 3 end) === 3 & +(if false then 3 end) === null diff --git a/AbuseFilter/tests/parserTests/in.r b/AbuseFilter/tests/parserTests/in.r deleted file mode 100644 index 4736e080..00000000 --- a/AbuseFilter/tests/parserTests/in.r +++ /dev/null @@ -1 +0,0 @@ -MATCH diff --git a/AbuseFilter/tests/parserTests/ip-in-range.t b/AbuseFilter/tests/parserTests/ip-in-range.t new file mode 100644 index 00000000..782ea83c --- /dev/null +++ b/AbuseFilter/tests/parserTests/ip-in-range.t @@ -0,0 +1,5 @@ +ip_in_range( '12.34.56.78', '12.34.56.0/24' ) & +ip_in_range( '12.34.56.78', '12.34.0.0/16' ) & +ip_in_range( '12.34.56.78', '12.0.0.0/8' ) & +ip_in_range( '1.1.1.1', '1.1.1.1/32' ) & +ip_in_range( '1.1.1.1', '0.0.0.0/1' )
\ No newline at end of file diff --git a/AbuseFilter/tests/parserTests/lazyboolinvert.r b/AbuseFilter/tests/parserTests/lazyboolinvert.r deleted file mode 100644 index 4736e080..00000000 --- a/AbuseFilter/tests/parserTests/lazyboolinvert.r +++ /dev/null @@ -1 +0,0 @@ -MATCH diff --git a/AbuseFilter/tests/parserTests/lazyfunction.r b/AbuseFilter/tests/parserTests/lazyfunction.r deleted file mode 100644 index 4736e080..00000000 --- a/AbuseFilter/tests/parserTests/lazyfunction.r +++ /dev/null @@ -1 +0,0 @@ -MATCH diff --git a/AbuseFilter/tests/parserTests/lazykeyword.r b/AbuseFilter/tests/parserTests/lazykeyword.r deleted file mode 100644 index 4736e080..00000000 --- a/AbuseFilter/tests/parserTests/lazykeyword.r +++ /dev/null @@ -1 +0,0 @@ -MATCH diff --git a/AbuseFilter/tests/parserTests/lazypow.r b/AbuseFilter/tests/parserTests/lazypow.r deleted file mode 100644 index 4736e080..00000000 --- a/AbuseFilter/tests/parserTests/lazypow.r +++ /dev/null @@ -1 +0,0 @@ -MATCH diff --git a/AbuseFilter/tests/parserTests/lazysum.r b/AbuseFilter/tests/parserTests/lazysum.r deleted file mode 100644 index 4736e080..00000000 --- a/AbuseFilter/tests/parserTests/lazysum.r +++ /dev/null @@ -1 +0,0 @@ -MATCH diff --git a/AbuseFilter/tests/parserTests/lazyunarys.r b/AbuseFilter/tests/parserTests/lazyunarys.r deleted file mode 100644 index 4736e080..00000000 --- a/AbuseFilter/tests/parserTests/lazyunarys.r +++ /dev/null @@ -1 +0,0 @@ -MATCH diff --git a/AbuseFilter/tests/parserTests/lcase.r b/AbuseFilter/tests/parserTests/lcase.r deleted file mode 100644 index 4736e080..00000000 --- a/AbuseFilter/tests/parserTests/lcase.r +++ /dev/null @@ -1 +0,0 @@ -MATCH diff --git a/AbuseFilter/tests/parserTests/length.r b/AbuseFilter/tests/parserTests/length.r deleted file mode 100644 index 4736e080..00000000 --- a/AbuseFilter/tests/parserTests/length.r +++ /dev/null @@ -1 +0,0 @@ -MATCH diff --git a/AbuseFilter/tests/parserTests/like.r b/AbuseFilter/tests/parserTests/like.r deleted file mode 100644 index 4736e080..00000000 --- a/AbuseFilter/tests/parserTests/like.r +++ /dev/null @@ -1 +0,0 @@ -MATCH diff --git a/AbuseFilter/tests/parserTests/multipleconditionals.t b/AbuseFilter/tests/parserTests/multipleconditionals.t new file mode 100644 index 00000000..74a7b9fb --- /dev/null +++ b/AbuseFilter/tests/parserTests/multipleconditionals.t @@ -0,0 +1,28 @@ +/* For T152281 */ +v1 := 0; v2 := 0; +if ( 1 == 1 ) then +( + v1 := 1; v2 := 1; +) +else +( + v1 := 2; v2 := 2; +) +end; + +if ( 1 == 1 ) then + ( v1 := 1; ) +else +( + v1 := 2; v2 := 2; +) +end; + +if ( 1 == 1 ) then + ( v1 := 2 === 2 ? 1 : 3; ) +else +( + v1 := 'x' === 'y' ? 2 : 3; + v2 := v1 ** 2; +) +end; diff --git a/AbuseFilter/tests/parserTests/multipleskipbraces.r b/AbuseFilter/tests/parserTests/multipleskipbraces.r deleted file mode 100644 index 4736e080..00000000 --- a/AbuseFilter/tests/parserTests/multipleskipbraces.r +++ /dev/null @@ -1 +0,0 @@ -MATCH diff --git a/AbuseFilter/tests/parserTests/mwexamples-arithmetic.r b/AbuseFilter/tests/parserTests/mwexamples-arithmetic.r deleted file mode 100644 index f629599c..00000000 --- a/AbuseFilter/tests/parserTests/mwexamples-arithmetic.r +++ /dev/null @@ -1 +0,0 @@ -MATCH
\ No newline at end of file diff --git a/AbuseFilter/tests/parserTests/mwexamples-arrays.r b/AbuseFilter/tests/parserTests/mwexamples-arrays.r deleted file mode 100644 index f629599c..00000000 --- a/AbuseFilter/tests/parserTests/mwexamples-arrays.r +++ /dev/null @@ -1 +0,0 @@ -MATCH
\ No newline at end of file diff --git a/AbuseFilter/tests/parserTests/mwexamples-arrays.t b/AbuseFilter/tests/parserTests/mwexamples-arrays.t index 91538fed..fb589e83 100644 --- a/AbuseFilter/tests/parserTests/mwexamples-arrays.t +++ b/AbuseFilter/tests/parserTests/mwexamples-arrays.t @@ -1,10 +1,18 @@ -/* Examples from [[mw:Extension:AbuseFilter/Rules format#Lists]] */ +/* Examples from [[mw:Extension:AbuseFilter/Rules format#Arrays]] */ -a_array := [ 5, 6, 7, 10]; -a_array[0] == 5 & -length(a_array) == 4 & -string(a_array) == "5\n6\n7\n10\n" & -5 in a_array == true & -'5' in a_array == true & -'5\n6' in a_array == true & -1 in a_array == true
\ No newline at end of file +my_array := [ 5, 6, 7, 10]; +my_array[0] == 5 & +length(my_array) == 4 & +int( my_array ) === 4 & +float( my_array ) === 4.0 & +string(my_array) == "5\n6\n7\n10\n" & +5 in my_array == true & +'5' in my_array == true & +'5\n6' in my_array == true & +1 in my_array == true & ( +my_array[] := 57; +my_array === [ 5, 6, 7, 10, 57 ] +) & ( +my_array[2] := 42; +my_array === [ 5, 6, 42, 10, 57 ] +) diff --git a/AbuseFilter/tests/parserTests/mwexamples-bools.r b/AbuseFilter/tests/parserTests/mwexamples-bools.r deleted file mode 100644 index f629599c..00000000 --- a/AbuseFilter/tests/parserTests/mwexamples-bools.r +++ /dev/null @@ -1 +0,0 @@ -MATCH
\ No newline at end of file diff --git a/AbuseFilter/tests/parserTests/mwexamples-comparisons.r b/AbuseFilter/tests/parserTests/mwexamples-comparisons.r deleted file mode 100644 index f629599c..00000000 --- a/AbuseFilter/tests/parserTests/mwexamples-comparisons.r +++ /dev/null @@ -1 +0,0 @@ -MATCH
\ No newline at end of file diff --git a/AbuseFilter/tests/parserTests/mwexamples-functions.r b/AbuseFilter/tests/parserTests/mwexamples-functions.r deleted file mode 100644 index f629599c..00000000 --- a/AbuseFilter/tests/parserTests/mwexamples-functions.r +++ /dev/null @@ -1 +0,0 @@ -MATCH
\ No newline at end of file diff --git a/AbuseFilter/tests/parserTests/mwexamples-functions.t b/AbuseFilter/tests/parserTests/mwexamples-functions.t deleted file mode 100644 index ea5bf1b1..00000000 --- a/AbuseFilter/tests/parserTests/mwexamples-functions.t +++ /dev/null @@ -1,22 +0,0 @@ -/* 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']
\ No newline at end of file diff --git a/AbuseFilter/tests/parserTests/mwexamples-keywords.r b/AbuseFilter/tests/parserTests/mwexamples-keywords.r deleted file mode 100644 index f629599c..00000000 --- a/AbuseFilter/tests/parserTests/mwexamples-keywords.r +++ /dev/null @@ -1 +0,0 @@ -MATCH
\ No newline at end of file diff --git a/AbuseFilter/tests/parserTests/norm.r b/AbuseFilter/tests/parserTests/norm.r deleted file mode 100644 index 4736e080..00000000 --- a/AbuseFilter/tests/parserTests/norm.r +++ /dev/null @@ -1 +0,0 @@ -MATCH diff --git a/AbuseFilter/tests/parserTests/norm.t b/AbuseFilter/tests/parserTests/norm.t deleted file mode 100644 index ed2d442a..00000000 --- a/AbuseFilter/tests/parserTests/norm.t +++ /dev/null @@ -1 +0,0 @@ -norm("foo") = "FO" & norm("any0ne") = "ANYONE" diff --git a/AbuseFilter/tests/parserTests/numbers.r b/AbuseFilter/tests/parserTests/numbers.r deleted file mode 100644 index 4736e080..00000000 --- a/AbuseFilter/tests/parserTests/numbers.r +++ /dev/null @@ -1 +0,0 @@ -MATCH diff --git a/AbuseFilter/tests/parserTests/numbers.t b/AbuseFilter/tests/parserTests/numbers.t index 1959a0fe..da9474b4 100644 --- a/AbuseFilter/tests/parserTests/numbers.t +++ b/AbuseFilter/tests/parserTests/numbers.t @@ -1 +1,9 @@ -ax = 10 & Fx = 15 & 10o = 8 & 10b = 2 +/* Things that are NOT numbers; */ +0xfoo := 'foobar'; +0b10bar := 'bar'; + +0xfoo === 'foobar' & 0b10bar === 'bar' & + +/* Actual numbers */ +0x1A === 0x1a & 0x1a === 26 & 0xa === 10 & 0b11111111 === 255 & 0o123 === 83 & 0x123 === 291 & 0xF === 15 & +0o10 === 8 & 0o1 === 1 & 0b101010 === 42 & 0b101010 === 0x2a & 0x2a === 0o52 diff --git a/AbuseFilter/tests/parserTests/ord.r b/AbuseFilter/tests/parserTests/ord.r deleted file mode 100644 index 4736e080..00000000 --- a/AbuseFilter/tests/parserTests/ord.r +++ /dev/null @@ -1 +0,0 @@ -MATCH diff --git a/AbuseFilter/tests/parserTests/prec.r b/AbuseFilter/tests/parserTests/prec.r deleted file mode 100644 index 4736e080..00000000 --- a/AbuseFilter/tests/parserTests/prec.r +++ /dev/null @@ -1 +0,0 @@ -MATCH diff --git a/AbuseFilter/tests/parserTests/rcount.r b/AbuseFilter/tests/parserTests/rcount.r deleted file mode 100644 index 4736e080..00000000 --- a/AbuseFilter/tests/parserTests/rcount.r +++ /dev/null @@ -1 +0,0 @@ -MATCH diff --git a/AbuseFilter/tests/parserTests/regex.r b/AbuseFilter/tests/parserTests/regex.r deleted file mode 100644 index 4736e080..00000000 --- a/AbuseFilter/tests/parserTests/regex.r +++ /dev/null @@ -1 +0,0 @@ -MATCH diff --git a/AbuseFilter/tests/parserTests/regex.t b/AbuseFilter/tests/parserTests/regex.t index 706da02d..4d2e6311 100644 --- a/AbuseFilter/tests/parserTests/regex.t +++ b/AbuseFilter/tests/parserTests/regex.t @@ -1 +1,6 @@ -"foobér" rlike "^[fq]o{2}\\S.r$" & "foo" regex "^f..?.$" +"foobér" rlike "^[fq]o{2}\\S.r$" & +"foo" regex "^f..?.$" & +"UPPERCASE" irlike "uppercase" & +"lowercase" irlike "LOWERCASE" & +"1234567" irlike "12345" & +"FoObAR" irlike "^[a-z]+$" diff --git a/AbuseFilter/tests/parserTests/rmdoubles.r b/AbuseFilter/tests/parserTests/rmdoubles.r deleted file mode 100644 index 4736e080..00000000 --- a/AbuseFilter/tests/parserTests/rmdoubles.r +++ /dev/null @@ -1 +0,0 @@ -MATCH diff --git a/AbuseFilter/tests/parserTests/rmspecials.r b/AbuseFilter/tests/parserTests/rmspecials.r deleted file mode 100644 index 4736e080..00000000 --- a/AbuseFilter/tests/parserTests/rmspecials.r +++ /dev/null @@ -1 +0,0 @@ -MATCH diff --git a/AbuseFilter/tests/parserTests/rmwhitespace.r b/AbuseFilter/tests/parserTests/rmwhitespace.r deleted file mode 100644 index 4736e080..00000000 --- a/AbuseFilter/tests/parserTests/rmwhitespace.r +++ /dev/null @@ -1 +0,0 @@ -MATCH diff --git a/AbuseFilter/tests/parserTests/sanitize.r b/AbuseFilter/tests/parserTests/sanitize.r deleted file mode 100644 index 4736e080..00000000 --- a/AbuseFilter/tests/parserTests/sanitize.r +++ /dev/null @@ -1 +0,0 @@ -MATCH diff --git a/AbuseFilter/tests/parserTests/shortcircuit-and.r b/AbuseFilter/tests/parserTests/shortcircuit-and.r deleted file mode 100644 index 33a8a805..00000000 --- a/AbuseFilter/tests/parserTests/shortcircuit-and.r +++ /dev/null @@ -1 +0,0 @@ -NOT_MATCH
\ No newline at end of file diff --git a/AbuseFilter/tests/parserTests/shortcircuit-and.t b/AbuseFilter/tests/parserTests/shortcircuit-and.t index d87746de..013d6f6f 100644 --- a/AbuseFilter/tests/parserTests/shortcircuit-and.t +++ b/AbuseFilter/tests/parserTests/shortcircuit-and.t @@ -1,2 +1,2 @@ /* The division by zero should not be executed and not crash the filter */ -false & 1/0
\ No newline at end of file +!(false & 1/0)
\ No newline at end of file diff --git a/AbuseFilter/tests/parserTests/shortcircuit-ops.t b/AbuseFilter/tests/parserTests/shortcircuit-ops.t new file mode 100644 index 00000000..ea64ce7b --- /dev/null +++ b/AbuseFilter/tests/parserTests/shortcircuit-ops.t @@ -0,0 +1,2 @@ +/* See T214642 */ +!(1 = 0 & 1 < 3 * 24 * ( 3600 + 47 ) ** 2) diff --git a/AbuseFilter/tests/parserTests/shortcircuit-or.r b/AbuseFilter/tests/parserTests/shortcircuit-or.r deleted file mode 100644 index 4736e080..00000000 --- a/AbuseFilter/tests/parserTests/shortcircuit-or.r +++ /dev/null @@ -1 +0,0 @@ -MATCH diff --git a/AbuseFilter/tests/parserTests/specialratio.r b/AbuseFilter/tests/parserTests/specialratio.r deleted file mode 100644 index 4736e080..00000000 --- a/AbuseFilter/tests/parserTests/specialratio.r +++ /dev/null @@ -1 +0,0 @@ -MATCH diff --git a/AbuseFilter/tests/parserTests/string.r b/AbuseFilter/tests/parserTests/string.r deleted file mode 100644 index 4736e080..00000000 --- a/AbuseFilter/tests/parserTests/string.r +++ /dev/null @@ -1 +0,0 @@ -MATCH diff --git a/AbuseFilter/tests/parserTests/string.t b/AbuseFilter/tests/parserTests/string.t index 47685ed9..d1467ef0 100644 --- a/AbuseFilter/tests/parserTests/string.t +++ b/AbuseFilter/tests/parserTests/string.t @@ -3,4 +3,9 @@ "a\"b" === 'a"b' & "a\rb" !== "a\r\nb" & "\x66\x6f\x6f" === "foo" & -"some\xstring" === "somexstring" +"some\xstring" === "some\\xstring" & +"some\vstring" === "some\\vstring" & +/* T238475 */ +'\x{}' === '\x' + '{}' & +length('\x{}') === 4 & +'foobar' rlike '[\x{61}-\x{7a}]' diff --git a/AbuseFilter/tests/parserTests/strpos.r b/AbuseFilter/tests/parserTests/strpos.r deleted file mode 100644 index 4736e080..00000000 --- a/AbuseFilter/tests/parserTests/strpos.r +++ /dev/null @@ -1 +0,0 @@ -MATCH diff --git a/AbuseFilter/tests/parserTests/substr.r b/AbuseFilter/tests/parserTests/substr.r deleted file mode 100644 index 4736e080..00000000 --- a/AbuseFilter/tests/parserTests/substr.r +++ /dev/null @@ -1 +0,0 @@ -MATCH diff --git a/AbuseFilter/tests/parserTests/tern.r b/AbuseFilter/tests/parserTests/tern.r deleted file mode 100644 index 4736e080..00000000 --- a/AbuseFilter/tests/parserTests/tern.r +++ /dev/null @@ -1 +0,0 @@ -MATCH diff --git a/AbuseFilter/tests/parserTests/ucase.r b/AbuseFilter/tests/parserTests/ucase.r deleted file mode 100644 index 4736e080..00000000 --- a/AbuseFilter/tests/parserTests/ucase.r +++ /dev/null @@ -1 +0,0 @@ -MATCH diff --git a/AbuseFilter/tests/parserTests/utf8.r b/AbuseFilter/tests/parserTests/utf8.r deleted file mode 100644 index 4736e080..00000000 --- a/AbuseFilter/tests/parserTests/utf8.r +++ /dev/null @@ -1 +0,0 @@ -MATCH diff --git a/AbuseFilter/tests/parserTests/vars.r b/AbuseFilter/tests/parserTests/vars.r deleted file mode 100644 index 4736e080..00000000 --- a/AbuseFilter/tests/parserTests/vars.r +++ /dev/null @@ -1 +0,0 @@ -MATCH diff --git a/AbuseFilter/tests/parserTests/whitespace1.r b/AbuseFilter/tests/parserTests/whitespace1.r deleted file mode 100644 index 4736e080..00000000 --- a/AbuseFilter/tests/parserTests/whitespace1.r +++ /dev/null @@ -1 +0,0 @@ -MATCH diff --git a/AbuseFilter/tests/parserTests/wptest1.r b/AbuseFilter/tests/parserTests/wptest1.r deleted file mode 100644 index 4736e080..00000000 --- a/AbuseFilter/tests/parserTests/wptest1.r +++ /dev/null @@ -1 +0,0 @@ -MATCH diff --git a/AbuseFilter/tests/parserTests/wptest2.r b/AbuseFilter/tests/parserTests/wptest2.r deleted file mode 100644 index 4736e080..00000000 --- a/AbuseFilter/tests/parserTests/wptest2.r +++ /dev/null @@ -1 +0,0 @@ -MATCH diff --git a/AbuseFilter/tests/parserTests/wptest3.r b/AbuseFilter/tests/parserTests/wptest3.r deleted file mode 100644 index 4736e080..00000000 --- a/AbuseFilter/tests/parserTests/wptest3.r +++ /dev/null @@ -1 +0,0 @@ -MATCH |