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

Side by Side Diff: tests/compiler/dart2js/deferred_follow_constant_dependencies_test.dart

Issue 2345083003: dart2js: run dartfmt on tests (Closed)
Patch Set: revert another multipart test Created 4 years, 3 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // Test that constants depended on by other constants are correctly deferred. 5 // Test that constants depended on by other constants are correctly deferred.
6 6
7 import 'package:async_helper/async_helper.dart'; 7 import 'package:async_helper/async_helper.dart';
8 import 'package:compiler/src/common.dart'; 8 import 'package:compiler/src/common.dart';
9 import 'package:compiler/src/constants/values.dart'; 9 import 'package:compiler/src/constants/values.dart';
10 import 'package:compiler/src/compiler.dart'; 10 import 'package:compiler/src/compiler.dart';
(...skipping 14 matching lines...) Expand all
25 List<ConstantValue> allConstants = []; 25 List<ConstantValue> allConstants = [];
26 26
27 addConstantWithDependendencies(ConstantValue c) { 27 addConstantWithDependendencies(ConstantValue c) {
28 allConstants.add(c); 28 allConstants.add(c);
29 c.getDependencies().forEach(addConstantWithDependendencies); 29 c.getDependencies().forEach(addConstantWithDependendencies);
30 } 30 }
31 31
32 backend.constants.compiledConstants.forEach(addConstantWithDependendencies); 32 backend.constants.compiledConstants.forEach(addConstantWithDependendencies);
33 for (String stringValue in ["cA", "cB", "cC"]) { 33 for (String stringValue in ["cA", "cB", "cC"]) {
34 ConstantValue constant = allConstants.firstWhere((constant) { 34 ConstantValue constant = allConstants.firstWhere((constant) {
35 return constant.isString 35 return constant.isString &&
36 && constant.primitiveValue.slowToString() == stringValue; 36 constant.primitiveValue.slowToString() == stringValue;
37 }); 37 });
38 Expect.notEquals(null, outputUnitForConstant(constant), 38 Expect.notEquals(null, outputUnitForConstant(constant),
39 "Constant value ${constant.toStructuredText()} has no output unit."); 39 "Constant value ${constant.toStructuredText()} has no output unit.");
40 Expect.notEquals(mainOutputUnit, outputUnitForConstant(constant), 40 Expect.notEquals(
41 mainOutputUnit,
42 outputUnitForConstant(constant),
41 "Constant value ${constant.toStructuredText()} " 43 "Constant value ${constant.toStructuredText()} "
42 "is in the main output unit."); 44 "is in the main output unit.");
43 } 45 }
44 }); 46 });
45 } 47 }
46 48
47 // The main library imports lib1 and lib2 deferred and use lib1.foo1 and 49 // The main library imports lib1 and lib2 deferred and use lib1.foo1 and
48 // lib2.foo2. This should trigger seperate outputunits for main, lib1 and lib2. 50 // lib2.foo2. This should trigger seperate outputunits for main, lib1 and lib2.
49 // 51 //
50 // Both lib1 and lib2 import lib3 directly and 52 // Both lib1 and lib2 import lib3 directly and
51 // both use lib3.foo3. Therefore a shared output unit for lib1 and lib2 should 53 // both use lib3.foo3. Therefore a shared output unit for lib1 and lib2 should
52 // be created. 54 // be created.
53 // 55 //
54 // lib1 and lib2 also import lib4 deferred, but lib1 uses lib4.bar1 and lib2 56 // lib1 and lib2 also import lib4 deferred, but lib1 uses lib4.bar1 and lib2
55 // uses lib4.bar2. So two output units should be created for lib4, one for each 57 // uses lib4.bar2. So two output units should be created for lib4, one for each
56 // import. 58 // import.
57 const Map MEMORY_SOURCE_FILES = const {"main.dart": """ 59 const Map MEMORY_SOURCE_FILES = const {
60 "main.dart": """
58 import 'lib.dart' deferred as lib; 61 import 'lib.dart' deferred as lib;
59 62
60 void main() { 63 void main() {
61 print(lib.L); 64 print(lib.L);
62 } 65 }
63 """, "lib.dart": """ 66 """,
67 "lib.dart": """
64 class C { 68 class C {
65 final a; 69 final a;
66 const C(this.a); 70 const C(this.a);
67 } 71 }
68 72
69 const L = const {"cA": const C(const {"cB": "cC"})}; 73 const L = const {"cA": const C(const {"cB": "cC"})};
70 """,}; 74 """,
75 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698