Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(352)

Side by Side Diff: utils/tests/pub/pub_cache_test.dart

Issue 12755024: add cache list command to pub (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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 on empty cache', () {
38 // Set up a cache.
39 dir(cachePath, [
40 dir('hosted', [
41 dir('pub.dartlang.org', [
Bob Nystrom 2013/03/13 17:44:07 What happens if this directory doesn't exist?
keertip 2013/03/13 18:09:48 Throws an exception. Added test for that. On 2013
42 ])
43 ])
44 ]).scheduleCreate();
45
46 schedulePub(args: ['cache', 'list'], output: '{"packages":{}}');
47 });
48
49 integration('running pub cache list', () {
50 // Set up a cache.
51 dir(cachePath, [
52 dir('hosted', [
53 dir('pub.dartlang.org', [
54 dir("foo-1.2.3", [
55 libPubspec("foo", "1.2.3"),
56 libDir("foo")
57 ]),
58 dir("bar-2.0.0", [
59 libPubspec("bar", "2.0.0"),
60 libDir("bar") ])
61 ])
62 ])
63 ]).scheduleCreate();
64
65 schedulePub(args: ['cache', 'list'], output:
66 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"\}\}\}$') );
67 });
68
69 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698