summaryrefslogtreecommitdiff
path: root/src/mongo/dbtests/matchertests.cpp
diff options
context:
space:
mode:
authorAaron <aaron@10gen.com>2012-03-20 16:15:23 -0700
committerAaron <aaron@10gen.com>2012-03-22 15:51:59 -0700
commit03aa01eb85b5b45beada9bb75a537d29295a51bf (patch)
tree85ff528c3facffd8b14bb69cc4ca4d4ca0372604 /src/mongo/dbtests/matchertests.cpp
parentfe485a09544bfc761c312e29db359b8e290f5155 (diff)
downloadmongo-03aa01eb85b5b45beada9bb75a537d29295a51bf.tar.gz
Store MatchDetails::_elemMatchKey as a string.
Diffstat (limited to 'src/mongo/dbtests/matchertests.cpp')
-rw-r--r--src/mongo/dbtests/matchertests.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/mongo/dbtests/matchertests.cpp b/src/mongo/dbtests/matchertests.cpp
index 7bb539a3b80..6810ec95b01 100644
--- a/src/mongo/dbtests/matchertests.cpp
+++ b/src/mongo/dbtests/matchertests.cpp
@@ -140,8 +140,10 @@ namespace MatcherTests {
Matcher matcher( BSON( "a.b" << 1 ) );
MatchDetails details;
details.requestElemMatchKey();
+ ASSERT( !details.hasElemMatchKey() );
ASSERT( matcher.matches( fromjson( "{ a:[ { b:1 } ] }" ), &details ) );
// The '0' entry of the 'a' array is matched.
+ ASSERT( details.hasElemMatchKey() );
ASSERT_EQUALS( string( "0" ), details.elemMatchKey() );
}
};
@@ -166,6 +168,7 @@ namespace MatcherTests {
ASSERT_EQUALS( "BasicCursor", cursor->toString() );
ASSERT( matcher.matchesCurrent( cursor.get(), &details ) );
// The '1' entry of the 'a' array is matched.
+ ASSERT( details.hasElemMatchKey() );
ASSERT_EQUALS( string( "1" ), details.elemMatchKey() );
}
};
@@ -190,6 +193,7 @@ namespace MatcherTests {
ASSERT_EQUALS( "BtreeCursor a.b_1", cursor->toString() );
ASSERT( matcher.matchesCurrent( cursor.get(), &details ) );
// The '2' entry of the 'a' array is matched.
+ ASSERT( details.hasElemMatchKey() );
ASSERT_EQUALS( string( "2" ), details.elemMatchKey() );
}
};
@@ -217,6 +221,7 @@ namespace MatcherTests {
ASSERT( !cursor->isMultiKey() );
ASSERT( matcher.matchesCurrent( cursor.get(), &details ) );
// The '0' entry of the 'a' array is matched.
+ ASSERT( details.hasElemMatchKey() );
ASSERT_EQUALS( string( "0" ), details.elemMatchKey() );
}
};