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

Unified Diff: test/main_test.ts

Issue 2225953002: Strip more unused features. (Closed) Base URL: git@github.com:dart-lang/js_facade_gen.git@master
Patch Set: 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
« package.json ('K') | « test/literal_test.ts ('k') | test/module_test.ts » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/main_test.ts
diff --git a/test/main_test.ts b/test/main_test.ts
index 971459209ad4432c6876d1671e4a1ce9673a3e66..4bb7830ec4fd0d9702f8503efd115dbc36b13428 100644
--- a/test/main_test.ts
+++ b/test/main_test.ts
@@ -4,111 +4,109 @@
import chai = require('chai');
import main = require('../lib/main');
-import {expectTranslate, expectErroneousCode} from './test_support';
+import {expectTranslate} from './test_support';
describe('main transpiler functionality', () => {
- describe('comments', () => {
- it('keeps leading comments', () => {
- expectTranslate(`
-function f() {
-/* A */ a;
-/* B */ b;
-}`).to.equal(`f() {
- /* A */ a;
- /* B */ b;
-}`);
- expectTranslate(`function f() {
-// A
-a
+ describe(
+ 'comments', () => {
+ it('keeps leading comments',
+ () => {
+ expectTranslate(`/* A */ var a;
+/* B */ var b;`).to.equal(`/* A */
+@JS()
+external get a;
+@JS()
+external set a(v);
+/* B */ @JS()
+external get b;
+@JS()
+external set b(v);`);
+ expectTranslate(`// A
+var a;
// B
-b
-}`).to.equal(`f() {
- // A
- a;
- // B
- b;
-}`);
- });
- it('keeps ctor comments', () => {
- expectTranslate('/** A */ class A {\n /** ctor */ constructor() {}}').to.equal(`/** A */
+var b;`).to.equal(`// A
+@JS()
+external get a;
+@JS()
+external set a(v);
+// B
+@JS()
+external get b;
+@JS()
+external set b(v);`);
+ });
+ it('keeps ctor comments', () => {
+ expectTranslate('/** A */ class A {\n /** ctor */ constructor() {}}').to.equal(`/** A */
+@JS()
class A {
- /** ctor */ A() {}
+ // @Ignore
+ A.fakeConstructor$();
+ /** ctor */ external factory A();
}`);
- });
- it('translates links to dart doc format', () => {
- expectTranslate('/** {@link this/place} */ a').to.equal('/** [this/place] */ a;');
- expectTranslate('/* {@link 1} {@link 2} */ a').to.equal('/* [1] [2] */ a;');
- });
- it('removes @module doc tags', () => {
- expectTranslate(`/** @module
- * This is a module for doing X.
- */`).to.equal(`/**
- * This is a module for doing X.
- */`);
- });
- it('removes @description doc tags', () => {
- expectTranslate(`/** @description
- * This is a module for doing X.
- */`).to.equal(`/**
- * This is a module for doing X.
- */`);
- });
- it('removes @depracted doc tags', () => {
- expectTranslate(`/**
- * Use SomethingElse instead.
- * @deprecated
- */`).to.equal(`/**
- * Use SomethingElse instead.
- *
- */`);
- });
- it('removes @param doc tags', () => {
- expectTranslate(`/**
- * Method to do blah.
- * @param doc Document.
- */`).to.equal(`/**
- * Method to do blah.
- *
- */`);
- });
- it('removes @return doc tags', () => {
- expectTranslate(`/**
- * Method to do blah.
- * @return {String}
- */`).to.equal(`/**
- * Method to do blah.
- *
- */`);
- });
- it('removes @throws doc tags', () => {
- expectTranslate(`/**
- * Method to do blah.
- * @throws ArgumentException If arguments are wrong
- */`).to.equal(`/**
- * Method to do blah.
- *
- */`);
- });
- });
-
- describe('errors', () => {
- it('reports multiple errors', () => {
- // Reports both the private field not having an underbar and protected being unsupported.
- let errorLines = new RegExp(
- 'delete operator is unsupported\n' +
- '.*void operator is unsupported');
- expectErroneousCode('delete x["y"]; void z;').to.throw(errorLines);
- });
- it('reports relative paths in errors', () => {
- chai.expect(() => expectTranslate({'/a/b/c.ts': 'delete x["y"];'}, {basePath: '/a'}))
- .to.throw(/^b\/c.ts:1/);
- });
- it('reports errors across multiple files', () => {
- expectErroneousCode({'a.ts': 'delete x["y"];', 'b.ts': 'delete x["y"];'}, {
- failFast: false
- }).to.throw(/^a\.ts.*\nb\.ts/);
- });
- });
+ });
+ it('translates links to dart doc format', () => {
+ expectTranslate('/** {@link this/place} */ var a').to.equal(`/** [this/place] */
+@JS()
+external get a;
+@JS()
+external set a(v);`);
+ expectTranslate('/* {@link 1} {@link 2} */ var a').to.equal(`/* [1] [2] */
+@JS()
+external get a;
+@JS()
+external set a(v);`);
+ });
+ it('removes @module doc tags', () => {
+ expectTranslate(`/** @module
+ * This is a module for doing X.
+ */`).to.equal(`/**
+ * This is a module for doing X.
+ */`);
+ });
+ it('removes @description doc tags', () => {
+ expectTranslate(`/** @description
+ * This is a module for doing X.
+ */`).to.equal(`/**
+ * This is a module for doing X.
+ */`);
+ });
+ it('removes @depracted doc tags', () => {
+ expectTranslate(`/**
+ * Use SomethingElse instead.
+ * @deprecated
+ */`).to.equal(`/**
+ * Use SomethingElse instead.
+ *
+ */`);
+ });
+ it('removes @param doc tags', () => {
+ expectTranslate(`/**
+ * Method to do blah.
+ * @param doc Document.
+ */`).to.equal(`/**
+ * Method to do blah.
+ *
+ */`);
+ });
+ it('removes @return doc tags', () => {
+ expectTranslate(`/**
+ * Method to do blah.
+ * @return {String}
+ */`).to.equal(`/**
+ * Method to do blah.
+ *
+ */`);
+ });
+ it('removes @throws doc tags', () => {
+ expectTranslate(`/**
+ * Method to do blah.
+ * @throws ArgumentException If arguments are wrong
+ */`).to.equal(`/**
+ * Method to do blah.
+ *
+ */`);
+ });
+ });
describe('output paths', () => {
it('writes within the path', () => {
« package.json ('K') | « test/literal_test.ts ('k') | test/module_test.ts » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698