From 2743fd39b163519db058b9bb380b76d41a8a861e Mon Sep 17 00:00:00 2001 From: Mike Dirolf Date: Tue, 2 Jun 2009 09:27:50 -0400 Subject: [PATCH] failing test case for index on subfield --- tests/test_db_api.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/test_db_api.rb b/tests/test_db_api.rb index b0d9d15..8547aac 100644 --- a/tests/test_db_api.rb +++ b/tests/test_db_api.rb @@ -327,8 +327,25 @@ class DBAPITest < Test::Unit::TestCase test.insert("hello" => "mike") test.insert("hello" => "world") assert @@db.error? + end + + def test_index_on_subfield + @@db.drop_collection("blah") + test = @@db.collection("blah") + + test.insert("hello" => {"a" => 4, "b" => 5}) + test.insert("hello" => {"a" => 7, "b" => 2}) + test.insert("hello" => {"a" => 4, "b" => 10}) + assert !@@db.error? @@db.drop_collection("blah") + test = @@db.collection("blah") + test.create_index("hello.a", unique=true) + + test.insert("hello" => {"a" => 4, "b" => 5}) + test.insert("hello" => {"a" => 7, "b" => 2}) + test.insert("hello" => {"a" => 4, "b" => 10}) + assert @@db.error? end def test_array