compare non-existent properties to undefined

This commit is contained in:
Ari Lazier 2016-04-28 13:21:30 -07:00
parent a9eaf93acb
commit 2c85f032d9
2 changed files with 5 additions and 5 deletions

View File

@ -226,7 +226,7 @@ template<typename T>
typename T::Object Schema<T>::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<T>::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));
}

View File

@ -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() {