mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter.git
synced 2024-11-23 13:46:48 +00:00
Add test for multiple conditions inside conditionals
The regression itself was fixed in I980aec3481a52ecc35f1811a366014a5581a7cdb, so this patch only adds a test for it. Also remove a comment about CachingParser failures: we don't want to encourage people to remove it from tests anymore. Bug: T152281 Change-Id: I3ad49050ea49bf45d3226878e091da3c8dbefdb1
This commit is contained in:
parent
3748c41e79
commit
430ba818d0
|
@ -118,9 +118,11 @@ class AFPTreeParser {
|
|||
$this->move();
|
||||
$position = $this->mPos;
|
||||
|
||||
if ( $this->mCur->type === AFPToken::TNONE ||
|
||||
if (
|
||||
$this->mCur->type === AFPToken::TNONE ||
|
||||
( $this->mCur->type === AFPToken::TBRACE && $this->mCur->value == ')' )
|
||||
) {
|
||||
// Handle special cases which the other parser handled in doLevelAtom
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
28
tests/parserTests/multipleconditionals.t
Normal file
28
tests/parserTests/multipleconditionals.t
Normal file
|
@ -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;
|
|
@ -32,10 +32,6 @@ abstract class AbuseFilterParserTestCase extends MediaWikiTestCase {
|
|||
if ( !$parsers ) {
|
||||
$parsers = [
|
||||
new AbuseFilterParser(),
|
||||
// The following line can be removed if some tests fail only due to CachingParser:
|
||||
// it is currently broken (T156095) and it could produce unwanted failures (T201193)
|
||||
// @ToDo: This comment can be safely removed (making sure that a CachingParser is
|
||||
// instantiated below) as T156095 will be resolved.
|
||||
new AbuseFilterCachingParser()
|
||||
];
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue