OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 'dart:io'; | 5 import 'dart:io'; |
6 import 'dart:uri'; | 6 import 'dart:uri'; |
7 | 7 |
8 import 'package:pathos/path.dart' as pathos; | 8 import 'package:pathos/path.dart' as pathos; |
9 import 'package:unittest/unittest.dart'; | 9 import 'package:unittest/unittest.dart'; |
10 | 10 |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 }); | 365 }); |
366 | 366 |
367 test('merging hide + hide takes the intersection', () { | 367 test('merging hide + hide takes the intersection', () { |
368 expect(new Export('', '', hide: ['x', 'y']) | 368 expect(new Export('', '', hide: ['x', 'y']) |
369 .merge(new Export('', '', hide: ['y', 'z'])), | 369 .merge(new Export('', '', hide: ['y', 'z'])), |
370 equals(new Export('', '', hide: ['y']))); | 370 equals(new Export('', '', hide: ['y']))); |
371 }); | 371 }); |
372 }); | 372 }); |
373 } | 373 } |
374 | 374 |
375 ExportMap parse(List<String> libraries) => | 375 ExportMap parse(List<String> libraries) { |
376 new ExportMap.parse( | 376 return new ExportMap.parse( |
377 libraries.map(libPath).map(pathToFileUri), | 377 libraries.map(libPath) |
| 378 .map(pathToFileUri), |
378 pathos.join(tempDir, 'packages')); | 379 pathos.join(tempDir, 'packages')); |
| 380 } |
379 | 381 |
380 void createLibrary(String name, [String contents]) { | 382 void createLibrary(String name, [String contents]) { |
381 if (contents == null) contents = ''; | 383 if (contents == null) contents = ''; |
382 new Directory(pathos.dirname(libPath(name))).createSync(recursive: true); | 384 new Directory(pathos.dirname(libPath(name))).createSync(recursive: true); |
383 new File(libPath(name)).writeAsStringSync(''' | 385 new File(libPath(name)).writeAsStringSync(''' |
384 library ${pathos.basename(name)}; | 386 library ${pathos.basename(name)}; |
385 $contents | 387 $contents |
386 '''); | 388 '''); |
387 } | 389 } |
388 | 390 |
389 String libPath(String name) => pathos.normalize(pathos.join(tempDir, name)); | 391 String libPath(String name) => pathos.normalize(pathos.join(tempDir, name)); |
390 | 392 |
391 void createTempDir() { | 393 void createTempDir() { |
392 tempDir = new Directory('').createTempSync().path; | 394 tempDir = new Directory('').createTempSync().path; |
393 new Directory(pathos.join(tempDir, 'packages')).createSync(); | 395 new Directory(pathos.join(tempDir, 'packages')).createSync(); |
394 } | 396 } |
395 | 397 |
396 void deleteTempDir() { | 398 void deleteTempDir() { |
397 new Directory(tempDir).deleteSync(recursive: true); | 399 new Directory(tempDir).deleteSync(recursive: true); |
398 } | 400 } |
OLD | NEW |