From 3af05ef74c2f6900887b0b9f31d6d13ed6a4e2ee Mon Sep 17 00:00:00 2001 From: Michael Klishin Date: Sun, 17 Mar 2013 19:55:19 +0400 Subject: [PATCH] Add a test for m.c/insert-batch with lazy sequence inputs --- test/monger/test/inserting_test.clj | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/monger/test/inserting_test.clj b/test/monger/test/inserting_test.clj index 607250d..dadbcd6 100644 --- a/test/monger/test/inserting_test.clj +++ b/test/monger/test/inserting_test.clj @@ -161,3 +161,11 @@ (dotimes [n 44] (is (monger.result/ok? (mc/insert-batch monger.core/*mongodb-database* "people" docs WriteConcern/NORMAL)))) (is (= 88 (mc/count collection))))) + +(deftest insert-a-batch-of-basic-documents-from-a-lazy-sequence + (let [collection "people" + numbers (range 0 1000)] + (is (monger.result/ok? (mc/insert-batch "people" (map (fn [^long l] + {:n l}) + numbers)))) + (is (= (count numbers) (mc/count collection)))))