From 13c94180c643d4b2ba8ebce6ff6a90e985dd42ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bargull?= Date: Fri, 1 Sep 2017 23:44:52 +0200 Subject: [PATCH] Fix bugs in class-field template and case files - Correct property access in class fields template - Remove assertions for properties which aren't present - Correct expected assertion value for uninitialized class field - Correct expected property descriptor attributes - Fix property tests in class-fields/string-literal-names.case - Pass restore option, otherwise it's not possible to call the method later - Fix async iteration tests to test iteration result objects --- src/class-fields/computed-names.case | 2 +- ...ls-decl-after-same-line-async-gen.template | 5 ++-- ...decl-after-same-line-async-method.template | 2 +- ...-after-same-line-static-async-gen.template | 5 ++-- ...ter-same-line-static-async-method.template | 2 +- .../cls-decl-multiple-definitions.template | 4 +-- ...decl-multiple-stacked-definitions.template | 8 ++--- .../cls-decl-new-sc-line-generator.template | 2 +- ...ls-expr-after-same-line-async-gen.template | 5 ++-- ...expr-after-same-line-async-method.template | 2 +- ...-after-same-line-static-async-gen.template | 5 ++-- ...ter-same-line-static-async-method.template | 2 +- .../cls-expr-multiple-definitions.template | 4 +-- ...expr-multiple-stacked-definitions.template | 8 ++--- .../cls-expr-new-sc-line-generator.template | 2 +- src/class-fields/string-literal-names.case | 30 +++++++++++++++++++ 16 files changed, 57 insertions(+), 31 deletions(-) diff --git a/src/class-fields/computed-names.case b/src/class-fields/computed-names.case index fcfaf53219..fc99050d6b 100644 --- a/src/class-fields/computed-names.case +++ b/src/class-fields/computed-names.case @@ -63,7 +63,7 @@ assert.sameValue(Object.hasOwnProperty.call(C.prototype, "not initialized"), fal assert.sameValue(Object.hasOwnProperty.call(C, "not initialized"), false); verifyProperty(c, "not initialized", { - value: "meep", + value: undefined, enumerable: true, writable: true, configurable: true diff --git a/src/class-fields/default/cls-decl-after-same-line-async-gen.template b/src/class-fields/default/cls-decl-after-same-line-async-gen.template index 49983da696..b30c14785d 100644 --- a/src/class-fields/default/cls-decl-after-same-line-async-gen.template +++ b/src/class-fields/default/cls-decl-after-same-line-async-gen.template @@ -21,10 +21,11 @@ verifyProperty(C.prototype, "m", { enumerable: false, configurable: true, writable: true, -}); +}, {restore: true}); /*{ assertions }*/ c.m().next().then(function(v) { - assert.sameValue(v, 42); + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); }, $DONE).then($DONE, $DONE); diff --git a/src/class-fields/default/cls-decl-after-same-line-async-method.template b/src/class-fields/default/cls-decl-after-same-line-async-method.template index a261640ddf..b494494da5 100644 --- a/src/class-fields/default/cls-decl-after-same-line-async-method.template +++ b/src/class-fields/default/cls-decl-after-same-line-async-method.template @@ -21,7 +21,7 @@ verifyProperty(C.prototype, "m", { enumerable: false, configurable: true, writable: true, -}); +}, {restore: true}); /*{ assertions }*/ diff --git a/src/class-fields/default/cls-decl-after-same-line-static-async-gen.template b/src/class-fields/default/cls-decl-after-same-line-static-async-gen.template index 5d5ad3f3e6..004559513d 100644 --- a/src/class-fields/default/cls-decl-after-same-line-static-async-gen.template +++ b/src/class-fields/default/cls-decl-after-same-line-static-async-gen.template @@ -21,10 +21,11 @@ verifyProperty(C, "m", { enumerable: false, configurable: true, writable: true, -}); +}, {restore: true}); /*{ assertions }*/ C.m().next().then(function(v) { - assert.sameValue(v, 42); + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); }, $DONE).then($DONE, $DONE); diff --git a/src/class-fields/default/cls-decl-after-same-line-static-async-method.template b/src/class-fields/default/cls-decl-after-same-line-static-async-method.template index f83605e613..9829f1f19e 100644 --- a/src/class-fields/default/cls-decl-after-same-line-static-async-method.template +++ b/src/class-fields/default/cls-decl-after-same-line-static-async-method.template @@ -21,7 +21,7 @@ verifyProperty(C, "m", { enumerable: false, configurable: true, writable: true, -}); +}, {restore: true}); /*{ assertions }*/ diff --git a/src/class-fields/default/cls-decl-multiple-definitions.template b/src/class-fields/default/cls-decl-multiple-definitions.template index 4aaa9f3069..5519f47e0e 100644 --- a/src/class-fields/default/cls-decl-multiple-definitions.template +++ b/src/class-fields/default/cls-decl-multiple-definitions.template @@ -43,7 +43,7 @@ assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); verifyProperty(c, "foo", { value: "foobar", - enumerable: false, + enumerable: true, configurable: true, writable: true, }); @@ -54,7 +54,7 @@ assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); verifyProperty(c, "bar", { value: "barbaz", - enumerable: false, + enumerable: true, configurable: true, writable: true, }); diff --git a/src/class-fields/default/cls-decl-multiple-stacked-definitions.template b/src/class-fields/default/cls-decl-multiple-stacked-definitions.template index d078ed5c05..52a7fc637a 100644 --- a/src/class-fields/default/cls-decl-multiple-stacked-definitions.template +++ b/src/class-fields/default/cls-decl-multiple-stacked-definitions.template @@ -15,17 +15,13 @@ class C { var c = new C(); -assert.sameValue(c.m(), 42); -assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); -assert.sameValue(c.m, C.prototype.m); - assert.sameValue(c.foo, "foobar"); assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); verifyProperty(c, "foo", { value: "foobar", - enumerable: false, + enumerable: true, configurable: true, writable: true, }); @@ -36,7 +32,7 @@ assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); verifyProperty(c, "bar", { value: "barbaz", - enumerable: false, + enumerable: true, configurable: true, writable: true, }); diff --git a/src/class-fields/default/cls-decl-new-sc-line-generator.template b/src/class-fields/default/cls-decl-new-sc-line-generator.template index c124d126e0..db8a636e1a 100644 --- a/src/class-fields/default/cls-decl-new-sc-line-generator.template +++ b/src/class-fields/default/cls-decl-new-sc-line-generator.template @@ -14,7 +14,7 @@ class C { var c = new C(); -assert.sameValue(c.g().next().value, 42); +assert.sameValue(c.m().next().value, 42); assert.sameValue(c.m, C.prototype.m); assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); diff --git a/src/class-fields/default/cls-expr-after-same-line-async-gen.template b/src/class-fields/default/cls-expr-after-same-line-async-gen.template index 4d5b119677..1d9aae8522 100644 --- a/src/class-fields/default/cls-expr-after-same-line-async-gen.template +++ b/src/class-fields/default/cls-expr-after-same-line-async-gen.template @@ -21,10 +21,11 @@ verifyProperty(C.prototype, "m", { enumerable: false, configurable: true, writable: true, -}); +}, {restore: true}); /*{ assertions }*/ c.m().next().then(function(v) { - assert.sameValue(v, 42); + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); }, $DONE).then($DONE, $DONE); diff --git a/src/class-fields/default/cls-expr-after-same-line-async-method.template b/src/class-fields/default/cls-expr-after-same-line-async-method.template index 52a8356a9b..18ebd86c79 100644 --- a/src/class-fields/default/cls-expr-after-same-line-async-method.template +++ b/src/class-fields/default/cls-expr-after-same-line-async-method.template @@ -21,7 +21,7 @@ verifyProperty(C.prototype, "m", { enumerable: false, configurable: true, writable: true, -}); +}, {restore: true}); /*{ assertions }*/ diff --git a/src/class-fields/default/cls-expr-after-same-line-static-async-gen.template b/src/class-fields/default/cls-expr-after-same-line-static-async-gen.template index f1fdb4f45d..2ce7c13c80 100644 --- a/src/class-fields/default/cls-expr-after-same-line-static-async-gen.template +++ b/src/class-fields/default/cls-expr-after-same-line-static-async-gen.template @@ -21,10 +21,11 @@ verifyProperty(C, "m", { enumerable: false, configurable: true, writable: true, -}); +}, {restore: true}); /*{ assertions }*/ C.m().next().then(function(v) { - assert.sameValue(v, 42); + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); }, $DONE).then($DONE, $DONE); diff --git a/src/class-fields/default/cls-expr-after-same-line-static-async-method.template b/src/class-fields/default/cls-expr-after-same-line-static-async-method.template index caa1f2f234..007288a4fa 100644 --- a/src/class-fields/default/cls-expr-after-same-line-static-async-method.template +++ b/src/class-fields/default/cls-expr-after-same-line-static-async-method.template @@ -21,7 +21,7 @@ verifyProperty(C, "m", { enumerable: false, configurable: true, writable: true, -}); +}, {restore: true}); /*{ assertions }*/ diff --git a/src/class-fields/default/cls-expr-multiple-definitions.template b/src/class-fields/default/cls-expr-multiple-definitions.template index a5440f6265..be05aed55a 100644 --- a/src/class-fields/default/cls-expr-multiple-definitions.template +++ b/src/class-fields/default/cls-expr-multiple-definitions.template @@ -43,7 +43,7 @@ assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); verifyProperty(c, "foo", { value: "foobar", - enumerable: false, + enumerable: true, configurable: true, writable: true, }); @@ -54,7 +54,7 @@ assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); verifyProperty(c, "bar", { value: "barbaz", - enumerable: false, + enumerable: true, configurable: true, writable: true, }); diff --git a/src/class-fields/default/cls-expr-multiple-stacked-definitions.template b/src/class-fields/default/cls-expr-multiple-stacked-definitions.template index bd0d63c784..ee9553f6ed 100644 --- a/src/class-fields/default/cls-expr-multiple-stacked-definitions.template +++ b/src/class-fields/default/cls-expr-multiple-stacked-definitions.template @@ -15,17 +15,13 @@ var C = class { var c = new C(); -assert.sameValue(c.m(), 42); -assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); -assert.sameValue(c.m, C.prototype.m); - assert.sameValue(c.foo, "foobar"); assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); verifyProperty(c, "foo", { value: "foobar", - enumerable: false, + enumerable: true, configurable: true, writable: true, }); @@ -36,7 +32,7 @@ assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); verifyProperty(c, "bar", { value: "barbaz", - enumerable: false, + enumerable: true, configurable: true, writable: true, }); diff --git a/src/class-fields/default/cls-expr-new-sc-line-generator.template b/src/class-fields/default/cls-expr-new-sc-line-generator.template index 5ddf98c7cd..50dafb9f38 100644 --- a/src/class-fields/default/cls-expr-new-sc-line-generator.template +++ b/src/class-fields/default/cls-expr-new-sc-line-generator.template @@ -14,7 +14,7 @@ var C = class { var c = new C(); -assert.sameValue(c.g().next().value, 42); +assert.sameValue(c.m().next().value, 42); assert.sameValue(c.m, C.prototype.m); assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); diff --git a/src/class-fields/string-literal-names.case b/src/class-fields/string-literal-names.case index 98e37d5d08..87260a46f2 100644 --- a/src/class-fields/string-literal-names.case +++ b/src/class-fields/string-literal-names.case @@ -26,6 +26,36 @@ assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "b"), false); + +verifyProperty(c, "b", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "c"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "c"), false); + +verifyProperty(c, "c", { + value: 39, + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "d"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "d"), false); + +verifyProperty(c, "d", { value: 42, enumerable: true, writable: true,