From f3d7855c9903b0bae68b30f7f6a7ebe34e79cdb9 Mon Sep 17 00:00:00 2001 From: Ari Lazier Date: Tue, 10 Nov 2015 16:11:57 -0800 Subject: [PATCH] test and fix for date queries --- src/object-store/parser/query_builder.cpp | 8 -------- tests/RealmTests.js | 11 ++++++++++- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/object-store/parser/query_builder.cpp b/src/object-store/parser/query_builder.cpp index b924eaa3..f1bbb9d4 100644 --- a/src/object-store/parser/query_builder.cpp +++ b/src/object-store/parser/query_builder.cpp @@ -203,14 +203,6 @@ struct ColumnGetter { } }; -template -struct ColumnGetter { - static Columns convert(TableGetter&& table, const PropertyExpression & expr, Arguments &args) - { - return table()->template column(expr.prop->table_column); - } -}; - template struct ValueGetter; diff --git a/tests/RealmTests.js b/tests/RealmTests.js index 6a65b646..67c7dfec 100644 --- a/tests/RealmTests.js +++ b/tests/RealmTests.js @@ -235,7 +235,7 @@ module.exports = BaseTest.extend({ }, testRealmObjects: function() { - var realm = new Realm({schema: [schemas.PersonObject]}); + var realm = new Realm({schema: [schemas.PersonObject, schemas.DefaultValues, schemas.TestObject]}); realm.write(function() { realm.create('PersonObject', ['Ari', 10, false]); realm.create('PersonObject', ['Tim', 11, false]); @@ -278,6 +278,15 @@ module.exports = BaseTest.extend({ TestCase.assertThrows(function() { realm.objects('PersonObject', 'age > {2} && age < {0}', 13, 10) }); + + realm.write(function() { + realm.create('DefaultValuesObject', {'dateCol': new Date(3)}); + realm.create('DefaultValuesObject', {'dateCol': new Date(4)}); + realm.create('DefaultValuesObject', {'dateCol': new Date(5)}); + }); + + TestCase.assertEqual(realm.objects('DefaultValuesObject', 'dateCol > {0}', new Date(4)).length, 1); + TestCase.assertEqual(realm.objects('DefaultValuesObject', 'dateCol <= {0}', new Date(4)).length, 2); }, testNotifications: function() {