From 2c85f032d913e5d3c023c0798b6f35cc731a1528 Mon Sep 17 00:00:00 2001 From: Ari Lazier Date: Thu, 28 Apr 2016 13:21:30 -0700 Subject: [PATCH] compare non-existent properties to undefined --- src/js_schema.hpp | 4 ++-- tests/js/migration-tests.js | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/js_schema.hpp b/src/js_schema.hpp index 83fff15a..da952da2 100644 --- a/src/js_schema.hpp +++ b/src/js_schema.hpp @@ -226,7 +226,7 @@ template typename T::Object Schema::object_for_schema(ContextType ctx, const realm::Schema &schema) { ObjectType object = Object::create_array(ctx); uint32_t count = 0; - for (auto object_schema : schema) { + for (auto& object_schema : schema) { Object::set_property(ctx, object, count++, object_for_object_schema(ctx, object_schema)); } return object; @@ -240,7 +240,7 @@ typename T::Object Schema::object_for_object_schema(ContextType ctx, const Ob Object::set_property(ctx, object, name_string, Value::from_string(ctx, object_schema.name)); ObjectType properties = Object::create_empty(ctx); - for (auto property : object_schema.properties) { + for (auto& property : object_schema.properties) { Object::set_property(ctx, properties, property.name, object_for_property(ctx, property)); } diff --git a/tests/js/migration-tests.js b/tests/js/migration-tests.js index 84cdad2a..eabadf25 100644 --- a/tests/js/migration-tests.js +++ b/tests/js/migration-tests.js @@ -99,9 +99,9 @@ module.exports = BaseTest.extend({ TestCase.assertEqual(oldObjects[0].prop0, 'stringValue'); TestCase.assertEqual(oldObjects[0].prop1, 1); - //TestCase.assertThrows(function() { oldObjects[0].renamed; }); + TestCase.assertEqual(oldObjects[0].renamed, undefined); - //TestCase.assertThrows(function() { newObjects[0].prop0; }); + TestCase.assertEqual(newObjects[0].prop0, undefined); TestCase.assertEqual(newObjects[0].renamed, ''); TestCase.assertEqual(newObjects[0].prop1, 1); @@ -113,7 +113,7 @@ module.exports = BaseTest.extend({ TestCase.assertEqual(objects.length, 1); TestCase.assertEqual(objects[0].renamed, 'stringValue'); TestCase.assertEqual(objects[0].prop1, 1); - TestCase.assertThrows(function() { newObjects[0].prop0; }); + TestCase.assertEqual(objects[0].prop0, undefined); }, testMigrationSchema: function() {