summaryrefslogtreecommitdiff
path: root/dbtests
diff options
context:
space:
mode:
authorAaron <aaron@10gen.com>2009-01-06 13:54:19 -0500
committerAaron <aaron@10gen.com>2009-01-06 13:54:19 -0500
commit9c4278f3ff97aa1d84cabd62364ccd49a5b62be7 (patch)
tree129b40eadd6efdcd176ea729d52e2a4269d7044b /dbtests
parent79f6f769af0dda7541baca27564dee10dbb279fb (diff)
downloadmongo-9c4278f3ff97aa1d84cabd62364ccd49a5b62be7.tar.gz
Fix up regexp parsing
Diffstat (limited to 'dbtests')
-rw-r--r--dbtests/jsobjtests.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/dbtests/jsobjtests.cpp b/dbtests/jsobjtests.cpp
index aa6681836ef..b7d48d75f8e 100644
--- a/dbtests/jsobjtests.cpp
+++ b/dbtests/jsobjtests.cpp
@@ -742,6 +742,28 @@ namespace FromJsonTests {
}
};
+ class RegexEscape : public Base {
+ virtual BSONObj bson() const {
+ BSONObjBuilder b;
+ b.appendRegex( "a", "\t", "c" );
+ return b.doneAndDecouple();
+ }
+ virtual string json() const {
+ return "{ \"a\" : { \"$regex\" : \"\\t\", \"$options\" : \"c\" } }";
+ }
+ };
+
+ class RegexWithQuotes : public Base {
+ virtual BSONObj bson() const {
+ BSONObjBuilder b;
+ b.appendRegex( "a", "\"", "" );
+ return b.doneAndDecouple();
+ }
+ virtual string json() const {
+ return "{ \"a\" : /\"/ }";
+ }
+ };
+
} // namespace FromJsonTests
class All : public UnitTest::Suite {
@@ -802,6 +824,8 @@ public:
add< FromJsonTests::BinDataPaddedDouble >();
add< FromJsonTests::Date >();
add< FromJsonTests::Regex >();
+ add< FromJsonTests::RegexEscape >();
+ add< FromJsonTests::RegexWithQuotes >();
}
};