Skip to content
Permalink
Browse files

additional test for the hstore_to_map() function

  • Loading branch information
nirvn committed Sep 14, 2018
1 parent b7a0c8c commit d41ffb0cb7f04213374441ff7070142d0ae028b1
Showing with 5 additions and 0 deletions.
  1. +5 −0 tests/src/core/testqgsexpression.cpp
@@ -2897,6 +2897,11 @@ class TestQgsExpression: public QObject
hstoreExpected[QStringLiteral( "test_mix" )] = "key with value in quotation marks";
QCOMPARE( QgsExpression( "hstore_to_map('\"test_quotes\"=>\"test \\\\\"quote\\\\\" symbol\",\"test_slashes\"=>\"test \\\\slash symbol\",test_mix=>\"key with value in quotation marks\"')" ).evaluate( &context ), QVariant( hstoreExpected ) );

hstoreExpected.clear();
hstoreExpected[QStringLiteral( "1" )] = "one";
// if a key is missing its closing quote, the map construction process will stop and a partial map is returned
QCOMPARE( QgsExpression( "hstore_to_map('\"1\"=>\"one\",\"2=>\"two\"')" ).evaluate( &context ), QVariant( hstoreExpected ) );

QStringList keysExpected;
keysExpected << QStringLiteral( "1" ) << QStringLiteral( "2" );
QCOMPARE( QgsExpression( "map_akeys(\"map\")" ).evaluate( &context ), QVariant( keysExpected ) );

0 comments on commit d41ffb0

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