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_tests'); | 5 #library('pub_tests'); |
6 | 6 |
7 #import('dart:io'); | 7 #import('dart:io'); |
8 | 8 |
9 #import('test_pub.dart'); | 9 #import('test_pub.dart'); |
10 #import('../../../lib/unittest/unittest.dart'); | 10 #import('../../../lib/unittest/unittest.dart'); |
11 | 11 |
12 main() { | 12 main() { |
13 group('running pub with no command', () { | 13 group('running pub with no command', () { |
14 testOutput('displays usage', | 14 testPub('displays usage', |
15 [], | 15 args: [], |
16 ''' | 16 output: ''' |
17 Pub is a package manager for Dart. | 17 Pub is a package manager for Dart. |
18 | 18 |
19 Usage: | 19 Usage: |
20 | 20 |
21 pub command [arguments] | 21 pub command [arguments] |
22 | 22 |
23 The commands are: | 23 The commands are: |
24 | 24 |
| 25 list print the contents of repositories |
25 version print Pub version | 26 version print Pub version |
26 | 27 |
27 Use "pub help [command]" for more information about a command.'''); | 28 Use "pub help [command]" for more information about a command.'''); |
28 }); | 29 }); |
29 | 30 |
30 group('the version command', () { | |
31 testOutput('displays the current version', | |
32 ['version'], 'Pub 0.0.0'); | |
33 }); | |
34 | |
35 group('an unknown command', () { | 31 group('an unknown command', () { |
36 testOutput('displays an error message', | 32 testPub('displays an error message', |
37 ['quylthulg'], | 33 args: ['quylthulg'], |
38 ''' | 34 output: ''' |
39 Unknown command "quylthulg". | 35 Unknown command "quylthulg". |
40 Run "pub help" to see available commands.''', | 36 Run "pub help" to see available commands.''', |
41 exitCode: 64); | 37 exitCode: 64); |
42 }); | 38 }); |
| 39 |
| 40 listCommand(); |
| 41 versionCommand(); |
43 } | 42 } |
| 43 |
| 44 listCommand() { |
| 45 group('list cache', () { |
| 46 testPub('treats an empty directory as a package', |
| 47 cache: [ |
| 48 dir('apple'), |
| 49 dir('banana'), |
| 50 dir('cherry') |
| 51 ], |
| 52 args: ['list', 'cache'], |
| 53 output: ''' |
| 54 apple |
| 55 banana |
| 56 cherry'''); |
| 57 }); |
| 58 } |
| 59 |
| 60 versionCommand() { |
| 61 group('the version command', () { |
| 62 testPub('displays the current version', |
| 63 args: ['version'], |
| 64 output: 'Pub 0.0.0'); |
| 65 }); |
| 66 } |
OLD | NEW |