| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 library ddc.test.dependency_graph_test; | 5 library ddc.test.dependency_graph_test; |
| 6 | 6 |
| 7 import 'package:unittest/compact_vm_config.dart'; | 7 import 'package:unittest/compact_vm_config.dart'; |
| 8 import 'package:unittest/unittest.dart'; | 8 import 'package:unittest/unittest.dart'; |
| 9 | 9 |
| 10 import 'package:dev_compiler/src/checker/dart_sdk.dart' | 10 import 'package:dev_compiler/src/checker/dart_sdk.dart' |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 library a2; | 42 library a2; |
| 43 import 'a3.dart'; | 43 import 'a3.dart'; |
| 44 import 'a4.dart'; | 44 import 'a4.dart'; |
| 45 export 'a5.dart'; | 45 export 'a5.dart'; |
| 46 part 'a6.dart'; | 46 part 'a6.dart'; |
| 47 ''', | 47 ''', |
| 48 '/a3.dart': 'library a3;', | 48 '/a3.dart': 'library a3;', |
| 49 '/a4.dart': 'library a4; export "a10.dart";', | 49 '/a4.dart': 'library a4; export "a10.dart";', |
| 50 '/a5.dart': 'library a5;', | 50 '/a5.dart': 'library a5;', |
| 51 '/a6.dart': 'part of a2;', | 51 '/a6.dart': 'part of a2;', |
| 52 '/a7.dart': 'library a7;', |
| 52 '/a8.dart': 'library a8; import "a8.dart";', | 53 '/a8.dart': 'library a8; import "a8.dart";', |
| 53 '/a9.dart': 'library a9; import "a8.dart";', | 54 '/a9.dart': 'library a9; import "a8.dart";', |
| 54 '/a10.dart': 'library a10;', | 55 '/a10.dart': 'library a10;', |
| 55 }; | 56 }; |
| 56 | 57 |
| 57 nodeOf(String filepath, [bool isPart = false]) => | 58 nodeOf(String filepath, [bool isPart = false]) => |
| 58 graph.nodeFromUri(new Uri.file(filepath), isPart); | 59 graph.nodeFromUri(new Uri.file(filepath), isPart); |
| 59 | 60 |
| 60 setUp(() { | 61 setUp(() { |
| 61 /// We completely reset the TestUriResolver to avoid interference between | 62 /// We completely reset the TestUriResolver to avoid interference between |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 expect(node.imports.length, 2); | 181 expect(node.imports.length, 2); |
| 181 expect(node.exports.length, 1); | 182 expect(node.exports.length, 1); |
| 182 expect(node.parts.length, 1); | 183 expect(node.parts.length, 1); |
| 183 expect(node.imports.contains(nodeOf('/a3.dart')), isTrue); | 184 expect(node.imports.contains(nodeOf('/a3.dart')), isTrue); |
| 184 expect(node.imports.contains(nodeOf('/a4.dart')), isTrue); | 185 expect(node.imports.contains(nodeOf('/a4.dart')), isTrue); |
| 185 expect(node.exports.contains(nodeOf('/a5.dart')), isTrue); | 186 expect(node.exports.contains(nodeOf('/a5.dart')), isTrue); |
| 186 expect(node.parts.contains(nodeOf('/a6.dart')), isTrue); | 187 expect(node.parts.contains(nodeOf('/a6.dart')), isTrue); |
| 187 | 188 |
| 188 node.source.contents.modificationTime++; | 189 node.source.contents.modificationTime++; |
| 189 node.source.contents.data = | 190 node.source.contents.data = |
| 190 'import "a3.dart"; export "a6.dart"; part "a8.dart";'; | 191 'import "a3.dart"; export "a7.dart"; part "a8.dart";'; |
| 191 node.update(graph); | 192 node.update(graph); |
| 192 | 193 |
| 193 expect(node.imports.length, 1); | 194 expect(node.imports.length, 1); |
| 194 expect(node.exports.length, 1); | 195 expect(node.exports.length, 1); |
| 195 expect(node.parts.length, 1); | 196 expect(node.parts.length, 1); |
| 196 expect(node.imports.contains(nodeOf('/a3.dart')), isTrue); | 197 expect(node.imports.contains(nodeOf('/a3.dart')), isTrue); |
| 197 expect(node.exports.contains(nodeOf('/a6.dart')), isTrue); | 198 expect(node.exports.contains(nodeOf('/a7.dart')), isTrue); |
| 198 expect(node.parts.contains(nodeOf('/a8.dart')), isTrue); | 199 expect(node.parts.contains(nodeOf('/a8.dart')), isTrue); |
| 199 }); | 200 }); |
| 200 }); | 201 }); |
| 201 | 202 |
| 202 group('local changes', () { | 203 group('local changes', () { |
| 203 group('needs rebuild', () { | 204 group('needs rebuild', () { |
| 204 test('in HTML', () { | 205 test('in HTML', () { |
| 205 var node = nodeOf('/index1.html'); | 206 var node = nodeOf('/index1.html'); |
| 206 node.update(graph); | 207 node.update(graph); |
| 207 expect(node.needsRebuild, isTrue); | 208 expect(node.needsRebuild, isTrue); |
| (...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 741 ..write(n.needsRebuild ? '[needs-rebuild] ' : '') | 742 ..write(n.needsRebuild ? '[needs-rebuild] ' : '') |
| 742 ..write(n.structureChanged ? '[structure-changed] ' : ' ') | 743 ..write(n.structureChanged ? '[structure-changed] ' : ' ') |
| 743 ..write('\n'); | 744 ..write('\n'); |
| 744 n.directDeps.forEach((e) => helper(e, indent: indent + 1)); | 745 n.directDeps.forEach((e) => helper(e, indent: indent + 1)); |
| 745 } | 746 } |
| 746 helper(node); | 747 helper(node); |
| 747 return sb.toString(); | 748 return sb.toString(); |
| 748 } | 749 } |
| 749 | 750 |
| 750 bool _same(Set a, Set b) => a.length == b.length && a.containsAll(b); | 751 bool _same(Set a, Set b) => a.length == b.length && a.containsAll(b); |
| OLD | NEW |