| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 library test.package.map.provider; | 5 library test.package.map.provider; |
| 6 | 6 |
| 7 import 'dart:convert'; | 7 import 'dart:convert'; |
| 8 | 8 |
| 9 import 'package:analyzer/file_system/file_system.dart'; | 9 import 'package:analyzer/file_system/file_system.dart'; |
| 10 import 'package:analyzer/file_system/memory_file_system.dart'; | 10 import 'package:analyzer/file_system/memory_file_system.dart'; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 packageName: folderPath | 45 packageName: folderPath |
| 46 } | 46 } |
| 47 }).packageMap; | 47 }).packageMap; |
| 48 expect(result, hasLength(1)); | 48 expect(result, hasLength(1)); |
| 49 expect(result.keys, contains(packageName)); | 49 expect(result.keys, contains(packageName)); |
| 50 expect(result[packageName], hasLength(1)); | 50 expect(result[packageName], hasLength(1)); |
| 51 expect(result[packageName][0], new isInstanceOf<Folder>()); | 51 expect(result[packageName][0], new isInstanceOf<Folder>()); |
| 52 expect(result[packageName][0].path, equals(folderPath)); | 52 expect(result[packageName][0].path, equals(folderPath)); |
| 53 }); | 53 }); |
| 54 | 54 |
| 55 test('ignore nonexistent folder', () { | 55 test("don't ignore nonexistent folder", () { |
| 56 String packageName = 'foo'; | 56 String packageName = 'foo'; |
| 57 String folderPath = '/path/to/folder'; | 57 String folderPath = '/path/to/folder'; |
| 58 Map<String, List<Folder>> result = parsePackageMap({ | 58 Map<String, List<Folder>> result = parsePackageMap({ |
| 59 'packages': { | 59 'packages': { |
| 60 packageName: folderPath | 60 packageName: folderPath |
| 61 } | 61 } |
| 62 }).packageMap; | 62 }).packageMap; |
| 63 expect(result, hasLength(0)); | 63 expect(result, hasLength(1)); |
| 64 expect(result.keys, contains(packageName)); |
| 65 expect(result[packageName], hasLength(1)); |
| 66 expect(result[packageName][0], new isInstanceOf<Folder>()); |
| 67 expect(result[packageName][0].path, equals(folderPath)); |
| 64 }); | 68 }); |
| 65 | 69 |
| 66 test('package maps to list', () { | 70 test('package maps to list', () { |
| 67 String packageName = 'foo'; | 71 String packageName = 'foo'; |
| 68 String folderPath1 = '/path/to/folder1'; | 72 String folderPath1 = '/path/to/folder1'; |
| 69 String folderPath2 = '/path/to/folder2'; | 73 String folderPath2 = '/path/to/folder2'; |
| 70 resourceProvider.newFolder(folderPath1); | 74 resourceProvider.newFolder(folderPath1); |
| 71 resourceProvider.newFolder(folderPath2); | 75 resourceProvider.newFolder(folderPath2); |
| 72 Map<String, List<Folder>> result = parsePackageMap({ | 76 Map<String, List<Folder>> result = parsePackageMap({ |
| 73 'packages': { | 77 'packages': { |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 Set<String> dependencies = parsePackageMap({ | 123 Set<String> dependencies = parsePackageMap({ |
| 120 'packages': {}, | 124 'packages': {}, |
| 121 'input_files': [relativeDependencyPath] | 125 'input_files': [relativeDependencyPath] |
| 122 }).dependencies; | 126 }).dependencies; |
| 123 expect(dependencies, hasLength(1)); | 127 expect(dependencies, hasLength(1)); |
| 124 expect(dependencies, contains(dependencyPath)); | 128 expect(dependencies, contains(dependencyPath)); |
| 125 }); | 129 }); |
| 126 }); | 130 }); |
| 127 }); | 131 }); |
| 128 } | 132 } |
| OLD | NEW |