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