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

Unified Diff: test/test_support.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/statement_test.ts ('k') | test/type_test.ts » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/test_support.ts
diff --git a/test/test_support.ts b/test/test_support.ts
index 0028161768a2d37adad30c16f70bbea5b6bb551e..83a70fb8c43920464879a8e4efa86d474cdc3a1a 100644
--- a/test/test_support.ts
+++ b/test/test_support.ts
@@ -13,11 +13,6 @@ export type Input = string | StringMap;
export function expectTranslate(tsCode: Input, options: main.TranspilerOptions = {}) {
let result = translateSource(tsCode, options);
- // The Dart formatter is aggressive at terminating statements with \n
- // which clutters the expectation output without providing value.
- if (result[result.length - 1] === '\n') {
- result = result.slice(0, -1);
- }
return chai.expect(result);
}
@@ -69,7 +64,7 @@ export function parseFiles(nameToContent: StringMap): ts.Program {
return program;
}
-export const FAKE_MAIN = 'angular2/some/main.ts';
+export const FAKE_MAIN = 'demo/some/main.ts';
export function translateSources(contents: Input, options: main.TranspilerOptions = {}): StringMap {
// Default to quick stack traces.
@@ -87,9 +82,14 @@ export function translateSources(contents: Input, options: main.TranspilerOption
return transpiler.translateProgram(program);
}
-
export function translateSource(contents: Input, options: main.TranspilerOptions = {}): string {
+ options.useHtml = true;
+
let results = translateSources(contents, options);
// Return the main outcome, from 'main.ts'.
- return results[FAKE_MAIN];
+ let result = results[FAKE_MAIN];
+ // strip out the package:js import as it clutters the output.
+ result = result.replace(/import "package:js\/js.dart";\s+/g, '');
+ result = result.replace(/^@JS\(\)\s+library [^;]+;\s+/g, '');
+ return result.trim();
}
« no previous file with comments | « test/statement_test.ts ('k') | test/type_test.ts » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698