mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-07-05 10:32:08 -05:00
Add and update tests for exponentiation
This commit is contained in:
@@ -54,7 +54,7 @@ x5 **= ''
|
||||
x5 **= {};
|
||||
|
||||
var x6: E;
|
||||
x6 *= b;
|
||||
x6 *= true;
|
||||
x6 *= ''
|
||||
x6 *= {};
|
||||
x6 **= b;
|
||||
x6 **= true;
|
||||
x6 **= ''
|
||||
x6 **= {};
|
||||
@@ -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;
|
||||
@@ -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;;
|
||||
|
||||
<number>--temp ** 3;
|
||||
<number>++temp ** 3;
|
||||
<number>temp-- ** 3;
|
||||
<number>temp++ ** 3;
|
||||
<number>-++temp ** 3;
|
||||
<number>-temp++ ** 3;
|
||||
<number>-temp-- ** 3;
|
||||
|
||||
<number>--temp ** 3 ** 1;
|
||||
<number>++temp ** 3 ** 1;
|
||||
<number>temp-- ** 3 ** 1;
|
||||
<number>temp++ ** 3 ** 1;
|
||||
<number>-++temp ** 3 ** 1;
|
||||
<number>-temp++ ** 3 ** 1;
|
||||
<number>-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;
|
||||
@@ -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}`)
|
||||
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`;
|
||||
|
||||
Reference in New Issue
Block a user