OLD | NEW |
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 import 'package:front_end/memory_file_system.dart'; | 5 import 'package:front_end/memory_file_system.dart'; |
6 import 'package:front_end/src/fasta/translate_uri.dart'; | 6 import 'package:front_end/src/fasta/translate_uri.dart'; |
7 import 'package:front_end/src/incremental/file_state.dart'; | 7 import 'package:front_end/src/incremental/file_state.dart'; |
8 import 'package:test/test.dart'; | 8 import 'package:test/test.dart'; |
9 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 9 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
10 | 10 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 FileState cFile = await fsState.getFile(c); | 86 FileState cFile = await fsState.getFile(c); |
87 FileState dFile = await fsState.getFile(d); | 87 FileState dFile = await fsState.getFile(d); |
88 | 88 |
89 expect(dFile.exports, hasLength(3)); | 89 expect(dFile.exports, hasLength(3)); |
90 { | 90 { |
91 NamespaceExport export_ = dFile.exports[0]; | 91 NamespaceExport export_ = dFile.exports[0]; |
92 expect(export_.library, aFile); | 92 expect(export_.library, aFile); |
93 expect(export_.combinators, hasLength(1)); | 93 expect(export_.combinators, hasLength(1)); |
94 expect(export_.combinators[0].isShow, isTrue); | 94 expect(export_.combinators[0].isShow, isTrue); |
95 expect(export_.combinators[0].names, unorderedEquals(['A', 'B'])); | 95 expect(export_.combinators[0].names, unorderedEquals(['A', 'B'])); |
96 expect(export_.filter('A'), isTrue); | 96 expect(export_.isExposed('A'), isTrue); |
97 expect(export_.filter('B'), isTrue); | 97 expect(export_.isExposed('B'), isTrue); |
98 expect(export_.filter('C'), isFalse); | 98 expect(export_.isExposed('C'), isFalse); |
99 expect(export_.filter('D'), isFalse); | 99 expect(export_.isExposed('D'), isFalse); |
100 } | 100 } |
101 { | 101 { |
102 NamespaceExport export_ = dFile.exports[1]; | 102 NamespaceExport export_ = dFile.exports[1]; |
103 expect(export_.library, bFile); | 103 expect(export_.library, bFile); |
104 expect(export_.combinators, hasLength(1)); | 104 expect(export_.combinators, hasLength(1)); |
105 expect(export_.combinators[0].isShow, isFalse); | 105 expect(export_.combinators[0].isShow, isFalse); |
106 expect(export_.combinators[0].names, unorderedEquals(['C', 'D'])); | 106 expect(export_.combinators[0].names, unorderedEquals(['C', 'D'])); |
107 expect(export_.filter('A'), isTrue); | 107 expect(export_.isExposed('A'), isTrue); |
108 expect(export_.filter('B'), isTrue); | 108 expect(export_.isExposed('B'), isTrue); |
109 expect(export_.filter('C'), isFalse); | 109 expect(export_.isExposed('C'), isFalse); |
110 expect(export_.filter('D'), isFalse); | 110 expect(export_.isExposed('D'), isFalse); |
111 } | 111 } |
112 { | 112 { |
113 NamespaceExport export_ = dFile.exports[2]; | 113 NamespaceExport export_ = dFile.exports[2]; |
114 expect(export_.library, cFile); | 114 expect(export_.library, cFile); |
115 expect(export_.combinators, hasLength(3)); | 115 expect(export_.combinators, hasLength(3)); |
116 expect(export_.combinators[0].isShow, isTrue); | 116 expect(export_.combinators[0].isShow, isTrue); |
117 expect( | 117 expect( |
118 export_.combinators[0].names, unorderedEquals(['A', 'B', 'C', 'D'])); | 118 export_.combinators[0].names, unorderedEquals(['A', 'B', 'C', 'D'])); |
119 expect(export_.combinators[1].isShow, isFalse); | 119 expect(export_.combinators[1].isShow, isFalse); |
120 expect(export_.combinators[1].names, unorderedEquals(['C'])); | 120 expect(export_.combinators[1].names, unorderedEquals(['C'])); |
121 expect(export_.combinators[2].isShow, isTrue); | 121 expect(export_.combinators[2].isShow, isTrue); |
122 expect(export_.combinators[2].names, unorderedEquals(['A', 'D'])); | 122 expect(export_.combinators[2].names, unorderedEquals(['A', 'D'])); |
123 expect(export_.filter('A'), isTrue); | 123 expect(export_.isExposed('A'), isTrue); |
124 expect(export_.filter('B'), isFalse); | 124 expect(export_.isExposed('B'), isFalse); |
125 expect(export_.filter('C'), isFalse); | 125 expect(export_.isExposed('C'), isFalse); |
126 expect(export_.filter('D'), isTrue); | 126 expect(export_.isExposed('D'), isTrue); |
127 } | 127 } |
128 } | 128 } |
129 | 129 |
130 test_topologicalOrder_cycleBeforeTarget() async { | 130 test_topologicalOrder_cycleBeforeTarget() async { |
131 var aUri = _writeFileDirectives('/a.dart'); | 131 var aUri = _writeFileDirectives('/a.dart'); |
132 var bUri = _writeFileDirectives('/b.dart', imports: ['c.dart']); | 132 var bUri = _writeFileDirectives('/b.dart', imports: ['c.dart']); |
133 var cUri = _writeFileDirectives('/c.dart', imports: ['b.dart']); | 133 var cUri = _writeFileDirectives('/c.dart', imports: ['b.dart']); |
134 var dUri = _writeFileDirectives('/d.dart', imports: ['a.dart', 'b.dart']); | 134 var dUri = _writeFileDirectives('/d.dart', imports: ['a.dart', 'b.dart']); |
135 | 135 |
136 FileState core = await fsState.getFile(_coreUri); | 136 FileState core = await fsState.getFile(_coreUri); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 Uri _writeFileDirectives(String path, | 204 Uri _writeFileDirectives(String path, |
205 {List<String> imports: const [], List<String> exports: const []}) { | 205 {List<String> imports: const [], List<String> exports: const []}) { |
206 return writeFile( | 206 return writeFile( |
207 path, | 207 path, |
208 ''' | 208 ''' |
209 ${imports.map((uri) => 'import "$uri";').join('\n')} | 209 ${imports.map((uri) => 'import "$uri";').join('\n')} |
210 ${exports.map((uri) => 'export "$uri";').join('\n')} | 210 ${exports.map((uri) => 'export "$uri";').join('\n')} |
211 '''); | 211 '''); |
212 } | 212 } |
213 } | 213 } |
OLD | NEW |