From 4fc74b2d8af9945f0cd058798c0b8e9888c54c75 Mon Sep 17 00:00:00 2001 From: Yui T Date: Mon, 21 Sep 2015 16:16:28 -0700 Subject: [PATCH] Add and update tests for exponentiation --- ...entiationAssignmentLHSCannotBeAssigned.ts} | 8 +- .../emitCompoundExponentiationOperator2.ts | 25 ++++ .../emitExponentiationOperator3.ts | 113 ++++++++++++++++++ ...ExponentiationOperatorInTemplateString1.ts | 34 ++++-- 4 files changed, 168 insertions(+), 12 deletions(-) rename tests/cases/conformance/es7/exponentiationOperator/{compoundExponentiationAssignmentLHSCanBeAssigned2.ts => compoundExponentiationAssignmentLHSCannotBeAssigned.ts} (93%) create mode 100644 tests/cases/conformance/es7/exponentiationOperator/emitCompoundExponentiationOperator2.ts create mode 100644 tests/cases/conformance/es7/exponentiationOperator/emitExponentiationOperator3.ts diff --git a/tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCanBeAssigned2.ts b/tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts similarity index 93% rename from tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCanBeAssigned2.ts rename to tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts index 7995cc8d668..93623f667b8 100644 --- a/tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCanBeAssigned2.ts +++ b/tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts @@ -54,7 +54,7 @@ x5 **= '' x5 **= {}; var x6: E; -x6 *= b; -x6 *= true; -x6 *= '' -x6 *= {}; \ No newline at end of file +x6 **= b; +x6 **= true; +x6 **= '' +x6 **= {}; \ No newline at end of file diff --git a/tests/cases/conformance/es7/exponentiationOperator/emitCompoundExponentiationOperator2.ts b/tests/cases/conformance/es7/exponentiationOperator/emitCompoundExponentiationOperator2.ts new file mode 100644 index 00000000000..216997be8cc --- /dev/null +++ b/tests/cases/conformance/es7/exponentiationOperator/emitCompoundExponentiationOperator2.ts @@ -0,0 +1,25 @@ +// @target:es5 + +var comp: number; + +comp **= 1; +comp **= comp **= 1; +comp **= comp **= 1 + 2; +comp **= comp **= 1 - 2; +comp **= comp **= 1 * 2; +comp **= comp **= 1 / 2; + +comp **= comp **= (1 + 2); +comp **= comp **= (1 - 2); +comp **= comp **= (1 * 2); +comp **= comp **= (1 / 2); + +comp **= comp **= 1 + 2 ** 3; +comp **= comp **= 1 - 2 ** 4; +comp **= comp **= 1 * 2 ** 5; +comp **= comp **= 1 / 2 ** 6; + +comp **= comp **= (1 + 2) ** 3; +comp **= comp **= (1 - 2) ** 4; +comp **= comp **= (1 * 2) ** 5; +comp **= comp **= (1 / 2) ** 6; diff --git a/tests/cases/conformance/es7/exponentiationOperator/emitExponentiationOperator3.ts b/tests/cases/conformance/es7/exponentiationOperator/emitExponentiationOperator3.ts new file mode 100644 index 00000000000..b3b5deaf83d --- /dev/null +++ b/tests/cases/conformance/es7/exponentiationOperator/emitExponentiationOperator3.ts @@ -0,0 +1,113 @@ +var temp: any; + +delete --temp ** 3; +delete ++temp ** 3; +delete temp-- ** 3; +delete temp++ ** 3; +delete -++temp ** 3; +delete -temp++ ** 3; +delete -temp-- ** 3; + +delete --temp ** 3 ** 1; +delete ++temp ** 3 ** 1; +delete temp-- ** 3 ** 1; +delete temp++ ** 3 ** 1; +delete -++temp ** 3 ** 1; +delete -temp++ ** 3 ** 1; +delete -temp-- ** 3 ** 1;; + +--temp ** 3; +++temp ** 3; +temp-- ** 3; +temp++ ** 3; +-++temp ** 3; +-temp++ ** 3; +-temp-- ** 3; + +--temp ** 3 ** 1; +++temp ** 3 ** 1; +temp-- ** 3 ** 1; +temp++ ** 3 ** 1; +-++temp ** 3 ** 1; +-temp++ ** 3 ** 1; +-temp-- ** 3 ** 1; + +typeof --temp ** 3; +typeof temp-- ** 3; +typeof 3 ** 4; +typeof temp++ ** 4; +typeof temp-- ** 4; +typeof -3 ** 4; +typeof -++temp ** 4; +typeof -temp++ ** 4; +typeof -temp-- ** 4; + +typeof --temp ** 3 ** 1; +typeof temp-- ** 3 ** 1; +typeof 3 ** 4 ** 1; +typeof temp++ ** 4 ** 1; +typeof temp-- ** 4 ** 1; +typeof -3 ** 4 ** 1; +typeof -++temp ** 4 ** 1; +typeof -temp++ ** 4 ** 1; +typeof -temp-- ** 4 ** 1; + +void --temp ** 3; +void temp-- ** 3; +void 3 ** 4; +void temp++ ** 4; +void temp-- ** 4; +void -3 ** 4; +void -++temp ** 4; +void -temp++ ** 4; +void -temp-- ** 4; + +void --temp ** 3 ** 1; +void temp-- ** 3 ** 1; +void 3 ** 4 ** 1; +void temp++ ** 4 ** 1; +void temp-- ** 4 ** 1; +void -3 ** 4 ** 1; +void -++temp ** 4 ** 1; +void -temp++ ** 4 ** 1; +void -temp-- ** 4 ** 1; + +~ --temp ** 3; +~ temp-- ** 3; +~ 3 ** 4; +~ temp++ ** 4; +~ temp-- ** 4; +~ -3 ** 4; +~ -++temp ** 4; +~ -temp++ ** 4; +~ -temp-- ** 4; + +~ --temp ** 3 ** 1; +~ temp-- ** 3 ** 1; +~ 3 ** 4 ** 1; +~ temp++ ** 4 ** 1; +~ temp-- ** 4 ** 1; +~ -3 ** 4 ** 1; +~ -++temp ** 4 ** 1; +~ -temp++ ** 4 ** 1; +~ -temp-- ** 4 ** 1; + +! --temp ** 3; +! temp-- ** 3; +! 3 ** 4; +! temp++ ** 4; +! temp-- ** 4; +! -3 ** 4; +! -++temp ** 4; +! -temp++ ** 4; +! -temp-- ** 4; + +! --temp ** 3 ** 1; +! temp-- ** 3 ** 1; +! 3 ** 4 ** 1; +! temp++ ** 4 ** 1; +! temp-- ** 4 ** 1; +! -3 ** 4 ** 1; +! -++temp ** 4 ** 1; +! -temp++ ** 4 ** 1; +! -temp-- ** 4 ** 1; \ No newline at end of file diff --git a/tests/cases/conformance/es7/exponentiationOperator/emitExponentiationOperatorInTemplateString1.ts b/tests/cases/conformance/es7/exponentiationOperator/emitExponentiationOperatorInTemplateString1.ts index 2b2f942c525..f79b22fedd7 100644 --- a/tests/cases/conformance/es7/exponentiationOperator/emitExponentiationOperatorInTemplateString1.ts +++ b/tests/cases/conformance/es7/exponentiationOperator/emitExponentiationOperatorInTemplateString1.ts @@ -1,10 +1,28 @@ var t1 = 10; var t2 = 10; -console.log(`${t1 ** t2}`) -console.log(`${t1 ** t2 ** t1}`) -console.log(`${t1 + t2 ** t1}`) -console.log(`${t1 - t2 ** t1}`) -console.log(`${t1 ** t2 + t1}`) -console.log(`${t1 ** t2 - t1}`) -console.log(`${t1 + t2 ** t2 + t1}`) -console.log(`${t1 - t2 ** t2 - t1}`) \ No newline at end of file +var s; +`Exp: ${t1 ** t2} abc`; +`Exp: ${t1 ** t2 ** t1} abc`; +`Exp: ${t1 + t2 ** t1} abc`; +`Exp: ${t1 - t2 ** t1} abc`; +`Exp: ${t1 ** t2 + t1} abc`; +`Exp: ${t1 ** t2 - t1} abc`; +`Exp: ${t1 + t2 ** t2 + t1} abc`; +`Exp: ${t1 - t2 ** t2 - t1} abc`; +`Exp: ${-t1 ** t2 - t1} abc`; +`Exp: ${+t1 ** t2 - t1} abc`; +`Exp: ${-++t1 ** t2 - t1} abc`; +`Exp: ${+--t1 ** t2 - t1} abc`; +`Exp: ${-t1++ ** t2 - t1} abc`; +`Exp: ${-t1-- ** t2 - t1} abc`; +`Exp: ${+t1++ ** t2 - t1} abc`; +`Exp: ${+t1-- ** t2 - t1} abc`; +`Exp: ${typeof t1 ** t2 ** t1} abc`; +`Exp: ${typeof t1 ** t2 + t1} abc`; +`Exp: ${typeof t1 ** (t2 - t1)} abc`; +`Exp: ${1 + typeof t1 ** t2 ** t1} abc`; +`Exp: ${2 + typeof t1 ** t2 ** ++t1} abc`; +`Exp: ${3 + typeof t1 ** t2 ** --t1} abc`; +`Exp: ${!t1 ** t2 ** t1} abc`; +`Exp: ${!t1 ** t2 ** ++t1} abc`; +`Exp: ${!t1 ** t2 ** --t1} abc`;