Allow undefined realm values.

This commit is contained in:
John-David Dalton
2016-02-06 00:30:13 -08:00
parent 88708ec00f
commit 1cf7093f46

View File

@@ -525,29 +525,27 @@
'', '',
' var object = {', ' var object = {',
" 'arguments': (function() { return arguments; }(1, 2, 3)),", " 'arguments': (function() { return arguments; }(1, 2, 3)),",
" 'array': [1, 2, 3],", " 'array': [1],",
" 'arrayBuffer': new (root.ArrayBuffer || noop),", " 'arrayBuffer': root.ArrayBuffer ? new root.ArrayBuffer : undefined,",
" 'boolean': Object(false),", " 'boolean': Object(false),",
" 'date': new Date,", " 'date': new Date,",
" 'errors': [new Error, new EvalError, new RangeError, new ReferenceError, new SyntaxError, new TypeError, new URIError],", " 'errors': [new Error, new EvalError, new RangeError, new ReferenceError, new SyntaxError, new TypeError, new URIError],",
" 'function': noop,", " 'function': noop,",
" 'map': new (root.Map || noop),", " 'map': root.Map ? new root.Map : undefined,",
" 'nan': NaN,", " 'nan': NaN,",
" 'null': null,", " 'null': null,",
" 'number': Object(0),", " 'number': Object(0),",
" 'object': { 'a': 1, 'b': 2, 'c': 3 },", " 'object': { 'a': 1 },",
" 'regexp': /x/,", " 'regexp': /x/,",
" 'set': new (root.Set || noop),", " 'set': root.Set ? new root.Set : undefined,",
" 'string': Object('a'),", " 'string': Object('a'),",
" 'symbol': Object((root.Symbol || noop)()),", " 'symbol': root.Symbol ? root.Symbol() : undefined,",
" 'undefined': undefined", " 'undefined': undefined",
' };', ' };',
'', '',
" ['" + typedArrays.join("', '") + "'].forEach(function(type) {", " ['" + typedArrays.join("', '") + "'].forEach(function(type) {",
' var Ctor = root[type]', ' var Ctor = root[type]',
' if (Ctor) {', ' object[type.toLowerCase()] = Ctor ? new Ctor(new ArrayBuffer(24)) : undefined;',
' object[type.toLowerCase()] = new Ctor(new ArrayBuffer(24));',
' }',
' });', ' });',
'', '',
' return object;', ' return object;',
@@ -573,29 +571,27 @@
'', '',
'var object = {', 'var object = {',
" 'arguments': (function() { return arguments; }(1, 2, 3)),", " 'arguments': (function() { return arguments; }(1, 2, 3)),",
" 'array': [1, 2, 3],", " 'array': [1],",
" 'arrayBuffer': new (root.ArrayBuffer || noop),", " 'arrayBuffer': root.ArrayBuffer ? new root.ArrayBuffer : undefined,",
" 'boolean': Object(false),", " 'boolean': Object(false),",
" 'date': new Date,", " 'date': new Date,",
" 'errors': [new Error, new EvalError, new RangeError, new ReferenceError, new SyntaxError, new TypeError, new URIError],", " 'errors': [new Error, new EvalError, new RangeError, new ReferenceError, new SyntaxError, new TypeError, new URIError],",
" 'function': noop,", " 'function': noop,",
" 'map': new (root.Map || noop),", " 'map': root.Map ? new root.Map : undefined,",
" 'nan': NaN,", " 'nan': NaN,",
" 'null': null,", " 'null': null,",
" 'number': Object(0),", " 'number': Object(0),",
" 'object': { 'a': 1, 'b': 2, 'c': 3 },", " 'object': { 'a': 1 },",
" 'regexp': /x/,", " 'regexp': /x/,",
" 'set': new (root.Set || noop),", " 'set': root.Set ? new root.Set : undefined,",
" 'string': Object('a'),", " 'string': Object('a'),",
" 'symbol': Object((root.Symbol || noop)()),", " 'symbol': root.Symbol ? root.Symbol() : undefined,",
" 'undefined': undefined", " 'undefined': undefined",
'};', '};',
'', '',
"_.each(['" + typedArrays.join("', '") + "'], function(type) {", "_.each(['" + typedArrays.join("', '") + "'], function(type) {",
' var Ctor = root[type];', ' var Ctor = root[type];',
' if (Ctor) {', ' object[type.toLowerCase()] = Ctor ? new Ctor(new ArrayBuffer(24)) : undefined;',
' object[type.toLowerCase()] = new Ctor(new ArrayBuffer(24));',
' }',
'});', '});',
'', '',
'_.assign(_._realm, object);', '_.assign(_._realm, object);',
@@ -8881,10 +8877,10 @@
assert.expect(4); assert.expect(4);
if (realm.object) { if (realm.object) {
assert.strictEqual(_.isEqual([1, 2, 3], realm.array), true); assert.strictEqual(_.isEqual([1], realm.array), true);
assert.strictEqual(_.isEqual([1, 2, 2], realm.array), false); assert.strictEqual(_.isEqual([2], realm.array), false);
assert.strictEqual(_.isEqual({ 'a': 1, 'b': 2, 'c': 3 }, realm.object), true); assert.strictEqual(_.isEqual({ 'a': 1 }, realm.object), true);
assert.strictEqual(_.isEqual({ 'a': 1, 'b': 2, 'c': 2 }, realm.object), false); assert.strictEqual(_.isEqual({ 'a': 2 }, realm.object), false);
} }
else { else {
skipTest(assert, 4); skipTest(assert, 4);
@@ -10644,7 +10640,7 @@
props = invoke(typedArrays, 'toLowerCase'); props = invoke(typedArrays, 'toLowerCase');
var expected = lodashStable.map(props, function(key) { var expected = lodashStable.map(props, function(key) {
return key in realm; return realm[key] !== undefined;
}); });
var actual = lodashStable.map(props, function(key) { var actual = lodashStable.map(props, function(key) {