| OLD | NEW | 
|---|
| (Empty) |  | 
|  | 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 | 
|  | 3 // BSD-style license that can be found in the LICENSE file. | 
|  | 4 | 
|  | 5 library pub_cache_test; | 
|  | 6 | 
|  | 7 import 'dart:io'; | 
|  | 8 import 'dart:json' as json; | 
|  | 9 import 'test_pub.dart'; | 
|  | 10 import '../../pub/io.dart'; | 
|  | 11 | 
|  | 12 main() { | 
|  | 13   initConfig(); | 
|  | 14 | 
|  | 15   integration('running pub cache displays error message', () { | 
|  | 16     schedulePub(args: ['cache'], | 
|  | 17         output: ''' | 
|  | 18           Inspect the system cache. | 
|  | 19 | 
|  | 20           Usage: pub cache list | 
|  | 21           ''', | 
|  | 22         error: 'The cache command expects one argument.', | 
|  | 23         exitCode: 64); | 
|  | 24   }); | 
|  | 25 | 
|  | 26   integration('running pub cache foo displays error message', () { | 
|  | 27     schedulePub(args: ['cache' ,'foo'], | 
|  | 28         output: ''' | 
|  | 29           Inspect the system cache. | 
|  | 30 | 
|  | 31           Usage: pub cache list | 
|  | 32           ''', | 
|  | 33         error: 'Unknown cache command "foo".', | 
|  | 34         exitCode: 64); | 
|  | 35   }); | 
|  | 36 | 
|  | 37   integration('running pub cache list when there is no cache', () { | 
|  | 38     schedulePub(args: ['cache', 'list'], output: '{"packages":{}}'); | 
|  | 39   }); | 
|  | 40 | 
|  | 41   integration('running pub cache list on empty cache', () { | 
|  | 42     // Set up a cache. | 
|  | 43     dir(cachePath, [ | 
|  | 44       dir('hosted', [ | 
|  | 45          dir('pub.dartlang.org', [ | 
|  | 46         ]) | 
|  | 47       ]) | 
|  | 48     ]).scheduleCreate(); | 
|  | 49 | 
|  | 50     schedulePub(args: ['cache', 'list'], output: '{"packages":{}}'); | 
|  | 51   }); | 
|  | 52 | 
|  | 53   integration('running pub cache list', () { | 
|  | 54     // Set up a cache. | 
|  | 55     dir(cachePath, [ | 
|  | 56       dir('hosted', [ | 
|  | 57          dir('pub.dartlang.org', [ | 
|  | 58           dir("foo-1.2.3", [ | 
|  | 59             libPubspec("foo", "1.2.3"), | 
|  | 60             libDir("foo") | 
|  | 61           ]), | 
|  | 62           dir("bar-2.0.0", [ | 
|  | 63             libPubspec("bar", "2.0.0"), | 
|  | 64             libDir("bar") ]) | 
|  | 65         ]) | 
|  | 66       ]) | 
|  | 67     ]).scheduleCreate(); | 
|  | 68 | 
|  | 69     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"\}\}\}$')
    ); | 
|  | 71   }); | 
|  | 72 | 
|  | 73 } | 
| OLD | NEW | 
|---|