Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Named variables for array_foreach
- Loading branch information
|
@@ -4776,7 +4776,10 @@ const QList<QgsExpressionFunction *> &QgsExpression::Functions() |
|
|
} |
|
|
|
|
|
QgsArrayForeachExpressionFunction::QgsArrayForeachExpressionFunction() |
|
|
: QgsExpressionFunction( QStringLiteral( "array_foreach" ), 2, QCoreApplication::tr( "Arrays" ) ) |
|
|
: QgsExpressionFunction( QStringLiteral( "array_foreach" ), QgsExpressionFunction::ParameterList() |
|
|
<< QgsExpressionFunction::Parameter( QStringLiteral( "array" ) ) |
|
|
<< QgsExpressionFunction::Parameter( QStringLiteral( "expression" ) ), |
|
|
QCoreApplication::tr( "Arrays" ) ) |
|
|
{ |
|
|
|
|
|
} |
|
|
|
@@ -2689,7 +2689,7 @@ class TestQgsExpression: public QObject |
|
|
|
|
|
QVariantList foreachExpected; |
|
|
foreachExpected << QStringLiteral( "ABC" ) << QStringLiteral( "HELLO" ); |
|
|
QCOMPARE( QgsExpression( "array_foreach(array('abc', 'hello'), upper(@element))" ).evaluate( &context ), QVariant( foreachExpected ) ); |
|
|
QCOMPARE( QgsExpression( "array_foreach(array:=array('abc', 'hello'), expression:=upper(@element))" ).evaluate( &context ), QVariant( foreachExpected ) ); |
|
|
|
|
|
QCOMPARE( QgsExpression( "array_intersect(array('1', '2', '3', '4'), array('4', '0', '2', '5'))" ).evaluate( &context ), QVariant( true ) ); |
|
|
QCOMPARE( QgsExpression( "array_intersect(array('1', '2', '3', '4'), array('0', '5'))" ).evaluate( &context ), QVariant( false ) ); |
|
|