| 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 library pub_cache_test; | 5 library pub_cache_test; |
| 6 | 6 |
| 7 import 'dart:io'; | 7 import 'dart:io'; |
| 8 import 'dart:json' as json; | 8 import 'dart:json' as json; |
| 9 |
| 10 import '../../../pkg/scheduled_test/lib/scheduled_test.dart'; |
| 11 |
| 12 import '../../pub/io.dart'; |
| 13 import 'descriptor.dart' as d; |
| 9 import 'test_pub.dart'; | 14 import 'test_pub.dart'; |
| 10 import '../../pub/io.dart'; | |
| 11 | 15 |
| 12 main() { | 16 main() { |
| 13 initConfig(); | 17 initConfig(); |
| 14 | 18 |
| 15 integration('running pub cache displays error message', () { | 19 integration('running pub cache displays error message', () { |
| 16 schedulePub(args: ['cache'], | 20 schedulePub(args: ['cache'], |
| 17 output: ''' | 21 output: ''' |
| 18 Inspect the system cache. | 22 Inspect the system cache. |
| 19 | 23 |
| 20 Usage: pub cache list | 24 Usage: pub cache list |
| (...skipping 12 matching lines...) Expand all Loading... |
| 33 error: 'Unknown cache command "foo".', | 37 error: 'Unknown cache command "foo".', |
| 34 exitCode: 64); | 38 exitCode: 64); |
| 35 }); | 39 }); |
| 36 | 40 |
| 37 integration('running pub cache list when there is no cache', () { | 41 integration('running pub cache list when there is no cache', () { |
| 38 schedulePub(args: ['cache', 'list'], output: '{"packages":{}}'); | 42 schedulePub(args: ['cache', 'list'], output: '{"packages":{}}'); |
| 39 }); | 43 }); |
| 40 | 44 |
| 41 integration('running pub cache list on empty cache', () { | 45 integration('running pub cache list on empty cache', () { |
| 42 // Set up a cache. | 46 // Set up a cache. |
| 43 dir(cachePath, [ | 47 d.dir(cachePath, [ |
| 44 dir('hosted', [ | 48 d.dir('hosted', [ |
| 45 dir('pub.dartlang.org', [ | 49 d.dir('pub.dartlang.org', [ |
| 46 ]) | 50 ]) |
| 47 ]) | 51 ]) |
| 48 ]).scheduleCreate(); | 52 ]).create(); |
| 49 | 53 |
| 50 schedulePub(args: ['cache', 'list'], output: '{"packages":{}}'); | 54 schedulePub(args: ['cache', 'list'], output: '{"packages":{}}'); |
| 51 }); | 55 }); |
| 52 | 56 |
| 53 integration('running pub cache list', () { | 57 integration('running pub cache list', () { |
| 54 // Set up a cache. | 58 // Set up a cache. |
| 55 dir(cachePath, [ | 59 d.dir(cachePath, [ |
| 56 dir('hosted', [ | 60 d.dir('hosted', [ |
| 57 dir('pub.dartlang.org', [ | 61 d.dir('pub.dartlang.org', [ |
| 58 dir("foo-1.2.3", [ | 62 d.dir("foo-1.2.3", [ |
| 59 libPubspec("foo", "1.2.3"), | 63 d.libPubspec("foo", "1.2.3"), |
| 60 libDir("foo") | 64 d.libDir("foo") |
| 61 ]), | 65 ]), |
| 62 dir("bar-2.0.0", [ | 66 d.dir("bar-2.0.0", [ |
| 63 libPubspec("bar", "2.0.0"), | 67 d.libPubspec("bar", "2.0.0"), |
| 64 libDir("bar") ]) | 68 d.libDir("bar") ]) |
| 65 ]) | 69 ]) |
| 66 ]) | 70 ]) |
| 67 ]).scheduleCreate(); | 71 ]).create(); |
| 68 | 72 |
| 69 schedulePub(args: ['cache', 'list'], output: | 73 schedulePub(args: ['cache', 'list'], output: |
| 70 new RegExp(r'\{"packages":\{"bar":\{"version":"2\.0\.0","location":"[^"]+b
ar-2\.0\.0"\},"foo":\{"version":"1\.2\.3","location":"[^"]+foo-1\.2\.3"\}\}\}$')
); | 74 new RegExp(r'\{"packages":\{"bar":\{"version":"2\.0\.0","location":' |
| 75 r'"[^"]+bar-2\.0\.0"\},"foo":\{"version":"1\.2\.3","location":' |
| 76 r'"[^"]+foo-1\.2\.3"\}\}\}$')); |
| 71 }); | 77 }); |
| 72 | 78 |
| 73 } | 79 } |
| OLD | NEW |