Skip to content

Commit

Permalink
More test for referencedVariables
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Oct 31, 2016
1 parent 25e9834 commit 6d38765
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tests/src/core/testqgsexpression.cpp
Expand Up @@ -1578,8 +1578,14 @@ class TestQgsExpression: public QObject
void referenced_variables()
{
QSet<QString> expectedVars;
expectedVars << QStringLiteral( "foo" ) << QStringLiteral( "bar" ) << QStringLiteral( "ppp" ) << QStringLiteral( "qqq" ) << QStringLiteral( "rrr" );
QgsExpression exp( QStringLiteral( "CASE WHEN intersects(@bar, $geometry) THEN @ppp ELSE @qqq * @rrr END + @foo IN (1, 2, 3)" ) );
expectedVars << QStringLiteral( "foo" )
<< QStringLiteral( "bar" )
<< QStringLiteral( "ppp" )
<< QStringLiteral( "qqq" )
<< QStringLiteral( "rrr" )
<< QStringLiteral( "sss" )
<< QStringLiteral( "ttt" );
QgsExpression exp( QStringLiteral( "CASE WHEN intersects(@bar, $geometry) THEN @ppp ELSE @qqq * @rrr END + @foo IN (1, 2, @sss) OR @ttt" ) );
QCOMPARE( exp.hasParserError(), false );
QSet<QString> refVar = exp.referencedVariables();

Expand Down

0 comments on commit 6d38765

Please sign in to comment.