diff options
Diffstat (limited to 'third_party/webkit/PerformanceTests/six-speed/tests/object-assign.es5')
-rw-r--r-- | third_party/webkit/PerformanceTests/six-speed/tests/object-assign.es5 | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/third_party/webkit/PerformanceTests/six-speed/tests/object-assign.es5 b/third_party/webkit/PerformanceTests/six-speed/tests/object-assign.es5 new file mode 100644 index 0000000000..33d1571d27 --- /dev/null +++ b/third_party/webkit/PerformanceTests/six-speed/tests/object-assign.es5 @@ -0,0 +1,28 @@ +var obj = { + a: 1, + b: true, + c: function () {}, + d: null, + e: 'e' +}; + +var fn = function (src) { + var o = {}; + var keys = Object.keys(src); + for (var i = 0; i < keys.length; ++i) { + var key = keys[i]; + o[key] = src[key]; + } + return o; +}; + +var r = fn(obj); +assertEqual(r.a, obj.a); +assertEqual(r.b, obj.b); +assertEqual(r.c, obj.c); +assertEqual(r.d, obj.d); +assertEqual(r.e, obj.e); + +test(function () { + fn(obj); +}); |