Skip to content
Permalink
Browse files

Test fixes

  • Loading branch information
m-kuhn committed Aug 23, 2018
1 parent db99c77 commit 61faf797ca0b31ca9fe31aee4a632d7b0fbc41a6
Showing with 3 additions and 3 deletions.
  1. +3 −3 tests/src/core/testqgsexpression.cpp
@@ -2691,8 +2691,8 @@ class TestQgsExpression: public QObject
foreachExpected << QStringLiteral( "ABC" ) << QStringLiteral( "HELLO" );
QCOMPARE( QgsExpression( "array_foreach(array('abc', 'hello'), upper(@element))" ).evaluate( &context ), QVariant( foreachExpected ) );

QVariantList filterExpected() << QStringLiteral( "A: a" ) << QStringLiteral( "A: d" );
QCOMPARE( QgsExpression( "array_filter(array('A: a', 'B: b', 'C: c', 'A: d'), substr(@element, 1, 2) = 'A:')" ).evaluate( &context ), QVariant( filterExpected ) );
QVariantList filterExpected = QVariantList() << QStringLiteral( "A: a" ) << QStringLiteral( "A: d" );
QCOMPARE( QgsExpression( "array_filter(array(array:='A: a', 'B: b', 'C: c', 'A: d'), expression:=substr(@element, 1, 2) = 'A:')" ).evaluate( &context ), QVariant( filterExpected ) );

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 ) );
@@ -2777,7 +2777,7 @@ class TestQgsExpression: public QObject
foreachExpected << 10 << 20 << 40;
QCOMPARE( QgsExpression( "array_foreach(array(1, 2, 4), @element * 10)" ).evaluate( &context ), QVariant( foreachExpected ) );

QVariantList filterExpected() << 1 << 2;
QVariantList filterExpected = QVariantList() << 1 << 2;
QCOMPARE( QgsExpression( "array_filter(array(1, 2, 4), @element < 3)" ).evaluate( &context ), QVariant( filterExpected ) );

QgsExpression badArray( QStringLiteral( "array_get('not an array', 0)" ) );

0 comments on commit 61faf79

Please sign in to comment.
You can’t perform that action at this time.