Skip to content

Commit

Permalink
additional test for the hstore_to_map() function
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn committed Sep 14, 2018
1 parent b7a0c8c commit d41ffb0
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tests/src/core/testqgsexpression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) );
Expand Down

0 comments on commit d41ffb0

Please sign in to comment.