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

Unified Diff: tests/compiler/dart2js/serialization/reserialization_test.dart

Issue 2088233003: Serialize erroneous element and more (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. Created 4 years, 6 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/serialization/reserialization_test.dart
diff --git a/tests/compiler/dart2js/serialization/reserialization_test.dart b/tests/compiler/dart2js/serialization/reserialization_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..691bdab44127e6ee1f598bd2756c3123cc4906fb
--- /dev/null
+++ b/tests/compiler/dart2js/serialization/reserialization_test.dart
@@ -0,0 +1,73 @@
+// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library dart2js.reserialization_test;
+
+import 'dart:async';
+import 'package:async_helper/async_helper.dart';
+import 'package:compiler/src/compiler.dart';
+import 'package:compiler/src/diagnostics/invariant.dart';
+import 'package:compiler/src/elements/elements.dart';
+import 'package:expect/expect.dart';
+import 'helper.dart';
+import 'test_helper.dart';
+import 'equivalence_test.dart';
+
+main(List<String> args) {
+ // Ensure that we can print out constant expressions.
+ DEBUG_MODE = true;
+
+ Arguments arguments = new Arguments.from(args);
+ Uri entryPoint;
+ if (arguments.filename != null) {
+ entryPoint = Uri.parse(arguments.filename);
+ } else {
+ entryPoint = Uri.parse('dart:core');
+ }
+ asyncTest(() async {
+ await testReserialization(entryPoint);
+ });
+}
+
+Future testReserialization(Uri entryPoint) async {
+ SerializationResult result1 = await serialize(entryPoint);
+ Compiler compiler1 = result1.compiler;
+ SerializedData serializedData1 = result1.serializedData;
+ Iterable<LibraryElement> libraries1 = compiler1.libraryLoader.libraries;
+
+ SerializationResult result2 = await serialize(entryPoint,
+ memorySourceFiles: serializedData1.toMemorySourceFiles(),
+ resolutionInputs: serializedData1.toUris());
+ Compiler compiler2 = result2.compiler;
+ SerializedData serializedData2 = result2.serializedData;
+ Iterable<LibraryElement> libraries2 = compiler2.libraryLoader.libraries;
+
+ SerializationResult result3 = await serialize(entryPoint,
+ memorySourceFiles: serializedData2.toMemorySourceFiles(),
+ resolutionInputs: serializedData2.toUris());
+ Compiler compiler3 = result3.compiler;
+ Iterable<LibraryElement> libraries3 = compiler3.libraryLoader.libraries;
+
+ for (LibraryElement library1 in libraries1) {
+ LibraryElement library2 = libraries2.firstWhere((LibraryElement library2) {
+ return library2.canonicalUri == library1.canonicalUri;
+ });
+ Expect.isNotNull(library2,
+ "No library found for ${library1.canonicalUri}.");
+ checkLibraryContent('library1', 'library2', 'library', library1, library2);
+
+ LibraryElement library3 = libraries3.firstWhere((LibraryElement library3) {
+ return library3.canonicalUri == library1.canonicalUri;
+ });
+ Expect.isNotNull(library3,
+ "No library found for ${library1.canonicalUri}.");
+ checkLibraryContent('library1', 'library3', 'library', library1, library3);
+ }
+
+ checkAllResolvedAsts(compiler1, compiler2);
+ checkAllResolvedAsts(compiler1, compiler3);
+
+ checkAllImpacts(compiler1, compiler2);
+ checkAllImpacts(compiler1, compiler3);
+}
« no previous file with comments | « tests/compiler/dart2js/serialization/helper.dart ('k') | tests/compiler/dart2js/serialization/resolved_ast_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698