| 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:polymer/src/info.dart'; | 9 import 'package:polymer/src/info.dart'; |
| 10 import 'package:polymer/src/paths.dart'; | 10 import 'package:polymer/src/paths.dart'; |
| 11 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'; | 12 import 'package:unittest/compact_vm_config.dart'; |
| 13 import 'package:unittest/unittest.dart'; | 13 import 'package:unittest/unittest.dart'; |
| 14 | 14 |
| 15 main() { | 15 main() { |
| 16 useCompactVMConfiguration(); | 16 useCompactVMConfiguration(); |
| 17 group('outdir == basedir:', () { | 17 group('paths', () { |
| 18 setUp(() { | 18 setUp(() { |
| 19 utils.path = new path.Builder(style: path.Style.posix); | 19 utils.path = new path.Builder(style: path.Style.posix); |
| 20 }); | 20 }); |
| 21 | 21 |
| 22 tearDown(() { | 22 tearDown(() { |
| 23 utils.path = new path.Builder(); | 23 utils.path = new path.Builder(); |
| 24 }); | 24 }); |
| 25 | 25 |
| 26 testPaths(); |
| 27 }); |
| 28 } |
| 29 |
| 30 testPaths() { |
| 31 group('outdir == basedir:', () { |
| 26 group('outputPath', () { | 32 group('outputPath', () { |
| 27 test('mangle automatic', () { | 33 test('mangle automatic', () { |
| 28 var pathMapper = _newPathMapper('a', 'a', false); | 34 var pathMapper = _newPathMapper('a', 'a', false); |
| 29 var file = _mockFile('a/b.dart', pathMapper); | 35 var file = _mockFile('a/b.dart', pathMapper); |
| 30 expect(file.dartCodeUrl.resolvedPath, 'a/b.dart'); | 36 expect(file.dartCodeUrl.resolvedPath, 'a/b.dart'); |
| 31 expect(pathMapper.outputPath(file.dartCodeUrl.resolvedPath, '.dart'), | 37 expect(pathMapper.outputPath(file.dartCodeUrl.resolvedPath, '.dart'), |
| 32 'a/_b.dart.dart'); | 38 'a/_b.dart.dart'); |
| 33 }); | 39 }); |
| 34 | 40 |
| 35 test('within packages/', () { | 41 test('within packages/', () { |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 var file = new FileInfo(new UrlInfo( | 330 var file = new FileInfo(new UrlInfo( |
| 325 url == null ? filePath : url, filePath, null)); | 331 url == null ? filePath : url, filePath, null)); |
| 326 file.outputFilename = pathMapper.mangle( | 332 file.outputFilename = pathMapper.mangle( |
| 327 utils.path.basename(filePath), '.dart', false); | 333 utils.path.basename(filePath), '.dart', false); |
| 328 return file; | 334 return file; |
| 329 } | 335 } |
| 330 | 336 |
| 331 _checkPath(String filePath, String expected) { | 337 _checkPath(String filePath, String expected) { |
| 332 expect(utils.path.normalize(filePath), expected); | 338 expect(utils.path.normalize(filePath), expected); |
| 333 } | 339 } |
| OLD | NEW |