diff --git a/tests/ecmascript/test-bi-reflect-ownkeys-symbol-order-2.js b/tests/ecmascript/test-bi-reflect-ownkeys-symbol-order-2.js new file mode 100644 index 00000000..7f665ef2 --- /dev/null +++ b/tests/ecmascript/test-bi-reflect-ownkeys-symbol-order-2.js @@ -0,0 +1,37 @@ +/*=== +0 +1 +2 +3 +7 +foo +bar +quux +S2 +S3 +S1 +===*/ + +var S1 = Symbol('s1'); +var S2 = Symbol('s2'); +var S3 = Symbol('s3'); + +var obj = {}; +obj[1] = 'one'; +obj['foo'] = 'foo'; +obj[0] = 'zero'; +obj[3] = 'three'; +obj[S2] = 's2'; +obj[2] = 'two'; +obj[S3] = 's3'; +obj['bar'] = 'bar'; +obj[S1] = 's1'; +obj['quux'] = 'quux'; +obj[7] = 'seven'; + +Reflect.ownKeys(obj).forEach(function (v) { + if (v === S1) { print('S1'); } + else if (v === S2) { print('S2'); } + else if (v === S3) { print('S3'); } + else { print(v); } +}); diff --git a/tests/ecmascript/test-bi-reflect-ownkeys-symbol-order-3.js b/tests/ecmascript/test-bi-reflect-ownkeys-symbol-order-3.js new file mode 100644 index 00000000..50a6db18 --- /dev/null +++ b/tests/ecmascript/test-bi-reflect-ownkeys-symbol-order-3.js @@ -0,0 +1,27 @@ +/*=== +foo +bar +quux +S2 +S3 +S1 +===*/ + +var S1 = Symbol('s1'); +var S2 = Symbol('s2'); +var S3 = Symbol('s3'); + +var obj = {}; +obj['foo'] = 'foo'; +obj[S2] = 's2'; +obj[S3] = 's3'; +obj['bar'] = 'bar'; +obj[S1] = 's1'; +obj['quux'] = 'quux'; + +Reflect.ownKeys(obj).forEach(function (v) { + if (v === S1) { print('S1'); } + else if (v === S2) { print('S2'); } + else if (v === S3) { print('S3'); } + else { print(v); } +}); diff --git a/tests/ecmascript/test-bi-reflect-ownkeys-symbol-order.js b/tests/ecmascript/test-bi-reflect-ownkeys-symbol-order.js new file mode 100644 index 00000000..bfaad97d --- /dev/null +++ b/tests/ecmascript/test-bi-reflect-ownkeys-symbol-order.js @@ -0,0 +1,28 @@ +/*=== +7 +300 +100 +500 +700 +200 +400 +600 +===*/ + +var sym1 = Symbol(); +var sym2 = Symbol(); +var sym3 = Symbol(); +var obj = {}; +obj.foo = 100; +obj[sym1] = 200; +obj[3] = 300; +obj[sym2] = 400; +obj.quux = 500; +obj[sym3] = 600; +obj.baz = 700; + +var keys = Reflect.ownKeys(obj); +print(keys.length); +keys.forEach(function (v) { + print(obj[v]); +});