| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 /** Tests for [PathMapper]. */ | 5 /** Tests for [PathMapper]. */ |
| 6 library path_info_test; | 6 library path_info_test; |
| 7 | 7 |
| 8 import 'package:path/path.dart' as path; | 8 import 'package:path/path.dart' as path; |
| 9 import 'package:unittest/compact_vm_config.dart'; | |
| 10 import 'package:unittest/unittest.dart'; | |
| 11 import 'package:polymer/src/info.dart'; | 9 import 'package:polymer/src/info.dart'; |
| 12 import 'package:polymer/src/paths.dart'; | 10 import 'package:polymer/src/paths.dart'; |
| 13 import 'package:polymer/src/utils.dart' as utils; | 11 import 'package:polymer/src/utils.dart' as utils; |
| 12 import 'package:unittest/compact_vm_config.dart'; |
| 13 import 'package:unittest/unittest.dart'; |
| 14 | 14 |
| 15 main() { | 15 main() { |
| 16 useCompactVMConfiguration(); | 16 useCompactVMConfiguration(); |
| 17 group('outdir == basedir:', () { | 17 group('outdir == basedir:', () { |
| 18 setUp(() { |
| 19 utils.path = new path.Builder(style: path.Style.posix); |
| 20 }); |
| 21 |
| 22 tearDown(() { |
| 23 utils.path = new path.Builder(); |
| 24 }); |
| 25 |
| 18 group('outputPath', () { | 26 group('outputPath', () { |
| 19 test('mangle automatic', () { | 27 test('mangle automatic', () { |
| 20 var pathMapper = _newPathMapper('a', 'a', false); | 28 var pathMapper = _newPathMapper('a', 'a', false); |
| 21 var file = _mockFile('a/b.dart', pathMapper); | 29 var file = _mockFile('a/b.dart', pathMapper); |
| 22 expect(file.dartCodeUrl.resolvedPath, 'a/b.dart'); | 30 expect(file.dartCodeUrl.resolvedPath, 'a/b.dart'); |
| 23 expect(pathMapper.outputPath(file.dartCodeUrl.resolvedPath, '.dart'), | 31 expect(pathMapper.outputPath(file.dartCodeUrl.resolvedPath, '.dart'), |
| 24 'a/_b.dart.dart'); | 32 'a/_b.dart.dart'); |
| 25 }); | 33 }); |
| 26 | 34 |
| 27 test('within packages/', () { | 35 test('within packages/', () { |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 var file = new FileInfo(new UrlInfo( | 324 var file = new FileInfo(new UrlInfo( |
| 317 url == null ? filePath : url, filePath, null)); | 325 url == null ? filePath : url, filePath, null)); |
| 318 file.outputFilename = pathMapper.mangle( | 326 file.outputFilename = pathMapper.mangle( |
| 319 utils.path.basename(filePath), '.dart', false); | 327 utils.path.basename(filePath), '.dart', false); |
| 320 return file; | 328 return file; |
| 321 } | 329 } |
| 322 | 330 |
| 323 _checkPath(String filePath, String expected) { | 331 _checkPath(String filePath, String expected) { |
| 324 expect(utils.path.normalize(filePath), expected); | 332 expect(utils.path.normalize(filePath), expected); |
| 325 } | 333 } |
| OLD | NEW |