-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Map
ts.ObjectLiteralExpression
, ts.BinaryExpression
, and `ts.Vari…
…ableDeclaration`
- Loading branch information
1 parent
989f8a1
commit 92fec89
Showing
7 changed files
with
377 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,159 @@ | ||
import {connect, disconnect, rewriteRun, typeScript} from '../testHarness'; | ||
|
||
describe('arithmetic operator mapping', () => { | ||
beforeAll(() => connect()); | ||
afterAll(() => disconnect()); | ||
|
||
test('plus', () => { | ||
rewriteRun( | ||
//language=typescript | ||
typeScript('1 + 2') | ||
); | ||
}); | ||
|
||
test('minus', () => { | ||
rewriteRun( | ||
//language=typescript | ||
typeScript('1 - 2') | ||
); | ||
}); | ||
|
||
test('multiply', () => { | ||
rewriteRun( | ||
//language=typescript | ||
typeScript('1 * 2') | ||
); | ||
}); | ||
|
||
test('divide', () => { | ||
rewriteRun( | ||
//language=typescript | ||
typeScript('1 / 2') | ||
); | ||
}); | ||
|
||
test('modulo', () => { | ||
rewriteRun( | ||
//language=typescript | ||
typeScript('1 % 2') | ||
); | ||
}); | ||
|
||
test('left shift', () => { | ||
rewriteRun( | ||
//language=typescript | ||
typeScript('1 << 2') | ||
); | ||
}); | ||
|
||
test('right shift', () => { | ||
rewriteRun( | ||
//language=typescript | ||
typeScript('1 >> 2') | ||
); | ||
}); | ||
|
||
test('unsigned right shift', () => { | ||
rewriteRun( | ||
//language=typescript | ||
typeScript('1 >>> 2') | ||
); | ||
}); | ||
}); | ||
|
||
describe('bitwise operator mapping', () => { | ||
beforeAll(() => connect()); | ||
afterAll(() => disconnect()); | ||
|
||
test('and', () => { | ||
rewriteRun( | ||
//language=typescript | ||
typeScript('1 & 2') | ||
); | ||
}); | ||
test('or', () => { | ||
rewriteRun( | ||
//language=typescript | ||
typeScript('1 | 2') | ||
); | ||
}); | ||
test('xor', () => { | ||
rewriteRun( | ||
//language=typescript | ||
typeScript('1 ^ 2') | ||
); | ||
}); | ||
}); | ||
|
||
describe('relational operator mapping', () => { | ||
beforeAll(() => connect()); | ||
afterAll(() => disconnect()); | ||
|
||
test('less than', () => { | ||
rewriteRun( | ||
//language=typescript | ||
typeScript('1 < 2') | ||
); | ||
}); | ||
test('less than or equal', () => { | ||
rewriteRun( | ||
//language=typescript | ||
typeScript('1 <= 2') | ||
); | ||
}); | ||
test('greater than', () => { | ||
rewriteRun( | ||
//language=typescript | ||
typeScript('1 > 2') | ||
); | ||
}); | ||
test('greater than or equal', () => { | ||
rewriteRun( | ||
//language=typescript | ||
typeScript('1 >= 2') | ||
); | ||
}); | ||
test('equal', () => { | ||
rewriteRun( | ||
//language=typescript | ||
typeScript('1 == 2') | ||
); | ||
}); | ||
test('not equal', () => { | ||
rewriteRun( | ||
//language=typescript | ||
typeScript('1 != 2') | ||
); | ||
}); | ||
|
||
test('strict equal', () => { | ||
rewriteRun( | ||
//language=typescript | ||
typeScript('1 === 2') | ||
); | ||
}); | ||
test('strict not equal', () => { | ||
rewriteRun( | ||
//language=typescript | ||
typeScript('1 !== 2') | ||
); | ||
}); | ||
}) | ||
|
||
describe('boolean operator mapping', () => { | ||
beforeAll(() => connect()); | ||
afterAll(() => disconnect()); | ||
|
||
test('and', () => { | ||
rewriteRun( | ||
//language=typescript | ||
typeScript('1 && 2') | ||
); | ||
}); | ||
test('or', () => { | ||
rewriteRun( | ||
//language=typescript | ||
typeScript('1 || 2') | ||
); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import {connect, disconnect, rewriteRun, typeScript} from '../testHarness'; | ||
|
||
describe('instanceof mapping', () => { | ||
beforeAll(() => connect()); | ||
afterAll(() => disconnect()); | ||
|
||
test('simple', () => { | ||
rewriteRun( | ||
//language=typescript | ||
typeScript('1 instanceof Object') | ||
); | ||
}); | ||
}); |
Oops, something went wrong.