Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(323)

Unified Diff: test/statement_test.ts

Issue 2225953002: Strip more unused features. (Closed) Base URL: git@github.com:dart-lang/js_facade_gen.git@master
Patch Set: Fix types Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/module_test.ts ('k') | test/test_support.ts » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/statement_test.ts
diff --git a/test/statement_test.ts b/test/statement_test.ts
deleted file mode 100644
index 6618c256ff881ca01b59633f3bdb20baa738c609..0000000000000000000000000000000000000000
--- a/test/statement_test.ts
+++ /dev/null
@@ -1,105 +0,0 @@
-/// <reference path="../typings/mocha/mocha.d.ts"/>
-import {expectTranslate} from './test_support';
-
-describe('statements', () => {
- it('translates switch', () => {
- expectTranslate('switch(x) { case 1: break; case 2: break; default: break; }')
- .to.equal(`switch (x) {
- case 1:
- break;
- case 2:
- break;
- default:
- break;
-}`);
- });
- it('translates for loops', () => {
- expectTranslate('for (1; 2; 3) { 4 }').to.equal(`for (1; 2; 3) {
- 4;
-}`);
- expectTranslate('for (var x = 1; 2; 3) { 4 }').to.equal(`for (var x = 1; 2; 3) {
- 4;
-}`);
- expectTranslate('for (var x, y = 1; 2; 3) { 4 }').to.equal(`for (var x, y = 1; 2; 3) {
- 4;
-}`);
- expectTranslate('for (var x = 0, y = 1; 2; 3) { 4 }').to.equal(`for (var x = 0, y = 1; 2; 3) {
- 4;
-}`);
- });
- it('translates for-in loops', () => {
- expectTranslate('for (var x in 1) { 2 }').to.equal(`for (var x in 1) {
- 2;
-}`);
- expectTranslate('for (x in 1) { 2 }').to.equal(`for (x in 1) {
- 2;
-}`);
- });
- it('translates for-of loops', () => {
- expectTranslate('for (var x of 1) { 2 }').to.equal(`for (var x in 1) {
- 2;
-}`);
- expectTranslate('for (x of 1) { 2 }').to.equal(`for (x in 1) {
- 2;
-}`);
- });
- it('translates while loops', () => {
- expectTranslate('while (1) { 2 }').to.equal(`while (1) {
- 2;
-}`);
- expectTranslate('do 1; while (2);').to.equal('do 1; while (2);');
- });
- it('translates if/then/else', () => {
- expectTranslate('if (x) { 1 }').to.equal(`if (x) {
- 1;
-}`);
- expectTranslate('if (x) { 1 } else { 2 }').to.equal(`if (x) {
- 1;
-} else {
- 2;
-}`);
- expectTranslate('if (x) 1;').to.equal('if (x) 1;');
- expectTranslate('if (x) 1; else 2;').to.equal(`if (x)
- 1;
-else
- 2;`);
- });
- it('translates try/catch', () => {
- expectTranslate('try {} catch(e) {} finally {}')
- .to.equal('try {} catch (e, e_stack) {} finally {}');
- expectTranslate('try {} catch(e: MyException) {}')
- .to.equal('try {} on MyException catch (e, e_stack) {}');
- });
- it('translates throw',
- () => { expectTranslate('throw new Error("oops")').to.equal('throw new Error("oops");'); });
- it('translates empty statements', () => { expectTranslate(';').to.equal(';'); });
- it('translates break & continue', () => {
- expectTranslate(`while (true) {
- break;
-}`).to.equal(`while (true) {
- break;
-}`);
- expectTranslate(`while (true) {
- continue;
-}`).to.equal(`while (true) {
- continue;
-}`);
- expectTranslate(`while (true) {
- break foo;
-}`).to.equal(`while (true) {
- break foo;
-}`);
- });
- it('rewrites catch block to preserve stack trace', () => {
- expectTranslate(`try {} catch (e) {
- console.log(e, e.stack);
-}`).to.equal(`try {} catch (e, e_stack) {
- console.log(e, e_stack);
-}`);
- });
- it('rewrites rethrow to preserve stack trace', () => {
- expectTranslate('try {} catch (ex) { throw ex; }').to.equal(`try {} catch (ex, ex_stack) {
- rethrow;
-}`);
- });
-});
« no previous file with comments | « test/module_test.ts ('k') | test/test_support.ts » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698