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 library pub_update_test; | 5 library pub_update_test; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:io'; | 8 import 'dart:io'; |
9 | 9 |
10 import 'package:unittest/unittest.dart'; | 10 import 'package:unittest/unittest.dart'; |
(...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
818 var name = parts[0]; | 818 var name = parts[0]; |
819 var version = parts[1]; | 819 var version = parts[1]; |
820 | 820 |
821 var package = mockPackage(name, version, dependencies); | 821 var package = mockPackage(name, version, dependencies); |
822 if (name == 'myapp') { | 822 if (name == 'myapp') { |
823 // Don't add the root package to the server, so we can verify that Pub | 823 // Don't add the root package to the server, so we can verify that Pub |
824 // doesn't try to look up information about the local package on the | 824 // doesn't try to look up information about the local package on the |
825 // remote server. | 825 // remote server. |
826 root = package; | 826 root = package; |
827 } else { | 827 } else { |
828 cache.sources[source].addPackage(name, package); | 828 (cache.sources[source] as MockSource).addPackage(name, package); |
829 } | 829 } |
830 }); | 830 }); |
831 }); | 831 }); |
832 | 832 |
833 // Clean up the expectation. | 833 // Clean up the expectation. |
834 if (result != null) { | 834 if (result != null) { |
835 var newResult = {}; | 835 var newResult = {}; |
836 result.forEach((name, version) { | 836 result.forEach((name, version) { |
837 parseSource(name, (isDev, name, source) { | 837 parseSource(name, (isDev, name, source) { |
838 version = new Version.parse(version); | 838 version = new Version.parse(version); |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1166 var source = "mock1"; | 1166 var source = "mock1"; |
1167 var match = new RegExp(r"(.*) from (.*)").firstMatch(description); | 1167 var match = new RegExp(r"(.*) from (.*)").firstMatch(description); |
1168 if (match != null) { | 1168 if (match != null) { |
1169 name = match[1]; | 1169 name = match[1]; |
1170 source = match[2]; | 1170 source = match[2]; |
1171 if (source == "root") source = null; | 1171 if (source == "root") source = null; |
1172 } | 1172 } |
1173 | 1173 |
1174 callback(isDev, name, source); | 1174 callback(isDev, name, source); |
1175 } | 1175 } |
OLD | NEW |