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