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

Unified Diff: tests/compiler/dart2js/deferred_emit_type_checks_test.dart

Issue 830703004: Emit to StreamCodeOutput instead of CodeBuffer. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments Created 5 years, 11 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
Index: tests/compiler/dart2js/deferred_emit_type_checks_test.dart
diff --git a/tests/compiler/dart2js/deferred_emit_type_checks_test.dart b/tests/compiler/dart2js/deferred_emit_type_checks_test.dart
index e236c691b4dee8c4ef91071503e3fe756b979819..f4f8295ba978f4d24833435cd3a4c43231254fc7 100644
--- a/tests/compiler/dart2js/deferred_emit_type_checks_test.dart
+++ b/tests/compiler/dart2js/deferred_emit_type_checks_test.dart
@@ -6,21 +6,9 @@
// Files when using deferred loading.
import 'package:expect/expect.dart';
-import "package:async_helper/async_helper.dart";
+import 'package:async_helper/async_helper.dart';
import 'memory_source_file_helper.dart';
-import "dart:async";
-
-import 'package:compiler/src/dart2jslib.dart'
- as dart2js;
-
-class MemoryOutputSink<T> extends EventSink<T> {
- List<T> mem = new List<T>();
- void add(T event) {
- mem.add(event);
- }
- void addError(T event, [StackTrace stackTrace]) {}
- void close() {}
-}
+import 'output_collector.dart';
void main() {
Uri script = currentDirectory.resolveUri(Platform.script);
@@ -30,30 +18,22 @@ void main() {
var provider = new MemorySourceFileProvider(MEMORY_SOURCE_FILES);
var handler = new FormattingDiagnosticHandler(provider);
- Map<String, MemoryOutputSink> outputs = new Map<String, MemoryOutputSink>();
-
- MemoryOutputSink outputSaver(name, extension) {
- if (name == '') {
- name = 'main';
- extension ='js';
- }
- return outputs.putIfAbsent("$name.$extension", () {
- return new MemoryOutputSink();
- });
- }
+ OutputCollector collector = new OutputCollector();
Compiler compiler = new Compiler(provider.readStringFromUri,
- outputSaver,
+ collector,
handler.diagnosticHandler,
libraryRoot,
packageRoot,
[],
{});
asyncTest(() => compiler.run(Uri.parse('memory:main.dart')).then((_) {
- String mainOutput = outputs['main.js'].mem[0];
- String deferredOutput = outputs['out_1.part.js'].mem[0];
+ String mainOutput = collector.getOutput('', 'js');
+ String deferredOutput = collector.getOutput('out_1', 'part.js');
String isPrefix = compiler.backend.namer.operatorIsPrefix;
- Expect.isTrue(deferredOutput.contains('${isPrefix}A: true'));
+ Expect.isTrue(deferredOutput.contains('${isPrefix}A: true'),
+ "Deferred output doesn't contain '${isPrefix}A: true':\n"
+ "$deferredOutput");
Expect.isFalse(mainOutput.contains('${isPrefix}A: true'));
}));
}
« no previous file with comments | « tests/compiler/dart2js/backend_dart/dart_printer_test.dart ('k') | tests/compiler/dart2js/library_resolution_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698