From 3d88cbfd3f3723194d6ff89b688f55d8043c8ad7 Mon Sep 17 00:00:00 2001 From: Kubilay Kahveci <mkahveci@bloomberg.net> Date: Tue, 9 Oct 2018 09:51:38 +0100 Subject: [PATCH] test: Add tests for private methods and accessors productions --- src/class-elements/rs-private-getter-alt.case | 108 ++++++++++++++++++ src/class-elements/rs-private-getter.case | 108 ++++++++++++++++++ src/class-elements/rs-private-method-alt.case | 107 +++++++++++++++++ src/class-elements/rs-private-method.case | 107 +++++++++++++++++ src/class-elements/rs-private-setter-alt.case | 107 +++++++++++++++++ src/class-elements/rs-private-setter.case | 107 +++++++++++++++++ 6 files changed, 644 insertions(+) create mode 100644 src/class-elements/rs-private-getter-alt.case create mode 100644 src/class-elements/rs-private-getter.case create mode 100644 src/class-elements/rs-private-method-alt.case create mode 100644 src/class-elements/rs-private-method.case create mode 100644 src/class-elements/rs-private-setter-alt.case create mode 100644 src/class-elements/rs-private-setter.case diff --git a/src/class-elements/rs-private-getter-alt.case b/src/class-elements/rs-private-getter-alt.case new file mode 100644 index 0000000000..4e2c9738b5 --- /dev/null +++ b/src/class-elements/rs-private-getter-alt.case @@ -0,0 +1,108 @@ +// Copyright (C) 2018 Kubilay Kahveci (Bloomberg LP). All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +desc: Valid PrivateName as private getter +info: | + + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ... + get ClassElementName ( ){ FunctionBody } + ... + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + <ZWNJ> <ZWJ> + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +template: productions +features: [class-methods-private] +---*/ + +//- fields +get #$() { + return this.#$_; +} +get #_() { + return this.#__; +} +get #\u{6F}() { + return this.#\u{6F}_; +} +get #℘() { + return this.#℘_; +} +get #ZW__NJ() { + return this.#ZW__NJ_; +} +get #ZW__J() { + return this.#ZW__J_; +} + +//- privateinspectionfunctions +$(value) { + this.#$_ = value; + return this.#$; +} +_(value) { + this.#__ = value; + return this.#_; +} +\u{6F}(value) { + this.#\u{6F}_ = value; + return this.#\u{6F}; +} +℘(value) { + this.#℘_ = value; + return this.#℘; +} +ZW__NJ(value) { + this.#ZW__NJ_ = value; + return this.#ZW__NJ; +} +ZW__J(value) { + this.#ZW__J_ = value; + return this.#ZW__J; +} + +//- assertions +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.℘(1), 1); +assert.sameValue(c.ZW__NJ(1), 1); +assert.sameValue(c.ZW__J(1), 1); diff --git a/src/class-elements/rs-private-getter.case b/src/class-elements/rs-private-getter.case new file mode 100644 index 0000000000..ddca5de1d5 --- /dev/null +++ b/src/class-elements/rs-private-getter.case @@ -0,0 +1,108 @@ +// Copyright (C) 2018 Kubilay Kahveci (Bloomberg LP). All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +desc: Valid PrivateName as private getter +info: | + + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ... + get ClassElementName ( ){ FunctionBody } + ... + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + <ZWNJ> <ZWJ> + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +template: productions +features: [class-methods-private] +---*/ + +//- fields +get #$() { + return this.#$_; +} +get #_() { + return this.#__; +} +get #\u{6F}() { + return this.#\u{6F}_; +} +get #\u2118() { + return this.#\u2118_; +} +get #ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ_; +} +get #ZW_\u200D_J() { + return this.#ZW_\u200D_J_; +} + +//- privateinspectionfunctions +$(value) { + this.#$_ = value; + return this.#$; +} +_(value) { + this.#__ = value; + return this.#_; +} +\u{6F}(value) { + this.#\u{6F}_ = value; + return this.#\u{6F}; +} +\u2118(value) { + this.#\u2118_ = value; + return this.#\u2118; +} +ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ_ = value; + return this.#ZW_\u200C_NJ; +} +ZW_\u200D_J(value) { + this.#ZW_\u200D_J_ = value; + return this.#ZW_\u200D_J; +} + +//- assertions +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.\u2118(1), 1); +assert.sameValue(c.ZW_\u200C_NJ(1), 1); +assert.sameValue(c.ZW_\u200D_J(1), 1); diff --git a/src/class-elements/rs-private-method-alt.case b/src/class-elements/rs-private-method-alt.case new file mode 100644 index 0000000000..2b190c1372 --- /dev/null +++ b/src/class-elements/rs-private-method-alt.case @@ -0,0 +1,107 @@ +// Copyright (C) 2018 Kubilay Kahveci (Bloomberg LP). All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +desc: Valid PrivateName as private method +info: | + + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ClassElementName ( UniqueFormalParameters ) { FunctionBody } + ... + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + <ZWNJ> <ZWJ> + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +template: productions +features: [class-methods-private] +---*/ + +//- fields +#$() { + return this.#$_; +} +#_() { + return this.#__; +} +#\u{6F}() { + return this.#\u{6F}_; +} +#℘() { + return this.#℘_; +} +#ZW__NJ() { + return this.#ZW__NJ_; +} +#ZW__J() { + return this.#ZW__J_; +} + +//- privateinspectionfunctions +$(value) { + this.#$_ = value; + return this.#$(); +} +_(value) { + this.#__ = value; + return this.#_(); +} +\u{6F}(value) { + this.#\u{6F}_ = value; + return this.#\u{6F}(); +} +℘(value) { + this.#℘_ = value; + return this.#℘(); +} +ZW__NJ(value) { + this.#ZW__NJ_ = value; + return this.#ZW__NJ(); +} +ZW__J(value) { + this.#ZW__J_ = value; + return this.#ZW__J(); +} + +//- assertions +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.℘(1), 1); +assert.sameValue(c.ZW__NJ(1), 1); +assert.sameValue(c.ZW__J(1), 1); diff --git a/src/class-elements/rs-private-method.case b/src/class-elements/rs-private-method.case new file mode 100644 index 0000000000..9a5e2a054e --- /dev/null +++ b/src/class-elements/rs-private-method.case @@ -0,0 +1,107 @@ +// Copyright (C) 2018 Kubilay Kahveci (Bloomberg LP). All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +desc: Valid PrivateName as private method +info: | + + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ClassElementName ( UniqueFormalParameters ) { FunctionBody } + ... + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + <ZWNJ> <ZWJ> + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +template: productions +features: [class-methods-private] +---*/ + +//- fields +#$() { + return this.#$_; +} +#_() { + return this.#__; +} +#\u{6F}() { + return this.#\u{6F}_; +} +#\u2118() { + return this.#\u2118_; +} +#ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ_; +} +#ZW_\u200D_J() { + return this.#ZW_\u200D_J_; +} + +//- privateinspectionfunctions +$(value) { + this.#$_ = value; + return this.#$(); +} +_(value) { + this.#__ = value; + return this.#_(); +} +\u{6F}(value) { + this.#\u{6F}_ = value; + return this.#\u{6F}(); +} +\u2118(value) { + this.#\u2118_ = value; + return this.#\u2118(); +} +ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ_ = value; + return this.#ZW_\u200C_NJ(); +} +ZW_\u200D_J(value) { + this.#ZW_\u200D_J_ = value; + return this.#ZW_\u200D_J(); +} + +//- assertions +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.\u2118(1), 1); +assert.sameValue(c.ZW_\u200C_NJ(1), 1); +assert.sameValue(c.ZW_\u200D_J(1), 1); diff --git a/src/class-elements/rs-private-setter-alt.case b/src/class-elements/rs-private-setter-alt.case new file mode 100644 index 0000000000..b104f0fc21 --- /dev/null +++ b/src/class-elements/rs-private-setter-alt.case @@ -0,0 +1,107 @@ +// Copyright (C) 2018 Kubilay Kahveci (Bloomberg LP). All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +desc: Valid PrivateName as private setter +info: | + + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ... + set ClassElementName ( PropertySetParameterList ) { FunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + <ZWNJ> <ZWJ> + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +template: productions +features: [class-methods-private] +---*/ + +//- fields +set #$(value) { + this.#$_ = value; +} +set #_(value) { + this.#__ = value; +} +set #\u{6F}(value) { + this.#\u{6F}_ = value; +} +set #℘(value) { + this.#℘_ = value; +} +set #ZW__NJ(value) { + this.#ZW__NJ_ = value; +} +set #ZW__J(value) { + this.#ZW__J_ = value; +} + +//- privateinspectionfunctions +$(value) { + this.#$ = value; + return this.#$_; +} +_(value) { + this.#_ = value; + return this.#__; +} +\u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}_; +} +℘(value) { + this.#℘ = value; + return this.#℘_; +} +ZW__NJ(value) { + this.#ZW__NJ = value; + return this.#ZW__NJ_; +} +ZW__J(value) { + this.#ZW__J = value; + return this.#ZW__J_; +} + +//- assertions +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.℘(1), 1); +assert.sameValue(c.ZW__NJ(1), 1); +assert.sameValue(c.ZW__J(1), 1); diff --git a/src/class-elements/rs-private-setter.case b/src/class-elements/rs-private-setter.case new file mode 100644 index 0000000000..a3347edf4c --- /dev/null +++ b/src/class-elements/rs-private-setter.case @@ -0,0 +1,107 @@ +// Copyright (C) 2018 Kubilay Kahveci (Bloomberg LP). All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +desc: Valid PrivateName as private setter +info: | + + ClassElement : + MethodDefinition + ... + ; + + MethodDefinition : + ... + set ClassElementName ( PropertySetParameterList ) { FunctionBody } + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + <ZWNJ> <ZWJ> + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +template: productions +features: [class-methods-private] +---*/ + +//- fields +set #$(value) { + this.#$_ = value; +} +set #_(value) { + this.#__ = value; +} +set #\u{6F}(value) { + this.#\u{6F}_ = value; +} +set #\u2118(value) { + this.#\u2118_ = value; +} +set #ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ_ = value; +} +set #ZW_\u200D_J(value) { + this.#ZW_\u200D_J_ = value; +} + +//- privateinspectionfunctions +$(value) { + this.#$ = value; + return this.#$_; +} +_(value) { + this.#_ = value; + return this.#__; +} +\u{6F}(value) { + this.#\u{6F} = value; + return this.#\u{6F}_; +} +\u2118(value) { + this.#\u2118 = value; + return this.#\u2118_; +} +ZW_\u200C_NJ(value) { + this.#ZW_\u200C_NJ = value; + return this.#ZW_\u200C_NJ_; +} +ZW_\u200D_J(value) { + this.#ZW_\u200D_J = value; + return this.#ZW_\u200D_J_; +} + +//- assertions +assert.sameValue(c.$(1), 1); +assert.sameValue(c._(1), 1); +assert.sameValue(c.\u{6F}(1), 1); +assert.sameValue(c.\u2118(1), 1); +assert.sameValue(c.ZW_\u200C_NJ(1), 1); +assert.sameValue(c.ZW_\u200D_J(1), 1); -- GitLab