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

Unified Diff: test/literal_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/js_interop_test.ts ('k') | test/main_test.ts » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/literal_test.ts
diff --git a/test/literal_test.ts b/test/literal_test.ts
deleted file mode 100644
index fe17250b7ab61dfee6afd9d9cf2fe81330f18aa0..0000000000000000000000000000000000000000
--- a/test/literal_test.ts
+++ /dev/null
@@ -1,64 +0,0 @@
-/// <reference path="../typings/mocha/mocha.d.ts"/>
-import {expectTranslate, expectErroneousCode} from './test_support';
-
-describe('literals', () => {
- it('translates string literals', () => {
- expectTranslate(`'hello\\' "world'`).to.equal(`"hello' \\"world";`);
- expectTranslate(`"hello\\" 'world"`).to.equal(`"hello\\" 'world";`);
- });
-
- it('translates string templates', () => {
- expectTranslate('`hello \nworld`').to.equal(`'''hello \nworld''';`);
- expectTranslate('`hello ${world}`').to.equal(`'''hello \${ world}''';`);
- expectTranslate('`${a}$b${$c}`').to.equal(`'''\${ a}\\$b\${ $c}''';`);
- expectTranslate('`\'${a}\'`').to.equal(`'''\\\'\${ a}\\\'''';`);
- expectTranslate('`\'a\'`').to.equal(`'''\\\'a\\\'''';`);
- // https://github.com/angular/angular/issues/509
- expectTranslate('"${a}"').to.equal('"\\${a}";');
- expectTranslate('"\\${a}"').to.equal('"\\${a}";');
- expectTranslate('\'\\${a}\'').to.equal('"\\${a}";');
- expectTranslate('\'$a\'').to.equal(`"\\$a";`);
- expectTranslate('`$a`').to.equal(`'''\\$a''';`);
- expectTranslate('`\\$a`').to.equal(`'''\\$a''';`);
- });
-
- it('escapes escape sequences',
- () => { expectTranslate('`\\\\u1234`').to.equal(`'''\\\\u1234''';`); });
-
- it('translates boolean literals', () => {
- expectTranslate('true').to.equal('true;');
- expectTranslate('false').to.equal('false;');
- expectTranslate('var b:boolean = true;').to.equal('bool b = true;');
- });
-
- it('translates the null literal', () => { expectTranslate('null').to.equal('null;'); });
-
- it('translates number literals', () => {
- // Negative numbers are handled by unary minus expressions.
- expectTranslate('1234').to.equal('1234;');
- expectTranslate('12.34').to.equal('12.34;');
- expectTranslate('1.23e-4').to.equal('1.23e-4;');
- });
-
- it('translates regexp literals', () => {
- expectTranslate('/wo\\/t?/g').to.equal('new RegExp(r\'wo\\/t?\');');
- expectTranslate('/\'/g').to.equal('new RegExp(r\'\' + "\'" + r\'\');');
- expectTranslate('/\'o\'/g').to.equal('new RegExp(r\'\' + "\'" + r\'o\' + "\'" + r\'\');');
- expectTranslate('/abc/gmi')
- .to.equal('new RegExp(r\'abc\', multiLine: true, caseSensitive: false);');
- expectErroneousCode('/abc/').to.throw(/Regular Expressions must use the \/\/g flag/);
- });
-
- it('translates array literals', () => {
- expectTranslate('[1,2]').to.equal('[1, 2];');
- expectTranslate('[1,]').to.equal('[1];');
- expectTranslate('[]').to.equal('[];');
- });
-
- it('translates object literals', () => {
- expectTranslate('var x = {a: 1, b: 2}').to.equal('var x = {"a": 1, "b": 2};');
- expectTranslate('var x = {a: 1, }').to.equal('var x = {"a": 1};');
- expectTranslate('var x = {}').to.equal('var x = {};');
- expectTranslate('var x = {y}').to.equal('var x = {"y": y};');
- });
-});
« no previous file with comments | « test/js_interop_test.ts ('k') | test/main_test.ts » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698