| 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 'package:scheduled_test/scheduled_test.dart'; | 7 import 'package:scheduled_test/scheduled_test.dart'; |
| 8 | 8 |
| 9 import 'descriptor.dart' as d; | 9 import 'descriptor.dart' as d; |
| 10 import 'test_pub.dart'; | 10 import 'test_pub.dart'; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 [all] Show all output including internal tracing messages. | 23 [all] Show all output including internal tracing messages. |
| 24 [io] Also show IO operations. | 24 [io] Also show IO operations. |
| 25 [normal] Show errors, warnings, and user messages. | 25 [normal] Show errors, warnings, and user messages. |
| 26 [solver] Show steps during version resolution. | 26 [solver] Show steps during version resolution. |
| 27 | 27 |
| 28 -v, --verbose Shortcut for "--verbosity=all". | 28 -v, --verbose Shortcut for "--verbosity=all". |
| 29 | 29 |
| 30 Available commands: | 30 Available commands: |
| 31 deploy Copy and compile all Dart entrypoints in the 'web' directory. | 31 deploy Copy and compile all Dart entrypoints in the 'web' directory. |
| 32 get Get the current package's dependencies. |
| 32 help Display help information for Pub. | 33 help Display help information for Pub. |
| 33 install Install the current package's dependencies. | |
| 34 publish Publish the current package to pub.dartlang.org. | 34 publish Publish the current package to pub.dartlang.org. |
| 35 serve Run a local web development server. | 35 serve Run a local web development server. |
| 36 update Update the current package's dependencies to the latest version
s. | 36 upgrade Upgrade the current package's dependencies to latest versions. |
| 37 uploader Manage uploaders for a package on pub.dartlang.org. | 37 uploader Manage uploaders for a package on pub.dartlang.org. |
| 38 version Print pub version. | 38 version Print pub version. |
| 39 | 39 |
| 40 Use "pub help [command]" for more information about a command. | 40 Use "pub help [command]" for more information about a command. |
| 41 """; | 41 """; |
| 42 | 42 |
| 43 final VERSION_STRING = ''' | 43 final VERSION_STRING = ''' |
| 44 Pub 0.1.2+3 | 44 Pub 0.1.2+3 |
| 45 '''; | 45 '''; |
| 46 | 46 |
| 47 main() { | 47 main() { |
| 48 initConfig(); | 48 initConfig(); |
| 49 | 49 |
| 50 integration('running pub with no command displays usage', () { | 50 integration('running pub with no command displays usage', () { |
| 51 schedulePub(args: [], output: USAGE_STRING); | 51 schedulePub(args: [], output: USAGE_STRING); |
| 52 }); | 52 }); |
| 53 | 53 |
| 54 integration('running pub with just --help displays usage', () { | 54 integration('running pub with just --help displays usage', () { |
| 55 schedulePub(args: ['--help'], output: USAGE_STRING); | 55 schedulePub(args: ['--help'], output: USAGE_STRING); |
| 56 }); | 56 }); |
| 57 | 57 |
| 58 integration('running pub with just -h displays usage', () { | 58 integration('running pub with just -h displays usage', () { |
| 59 schedulePub(args: ['-h'], output: USAGE_STRING); | 59 schedulePub(args: ['-h'], output: USAGE_STRING); |
| 60 }); | 60 }); |
| 61 | 61 |
| 62 integration('running pub with --help after command shows command usage', () { | 62 integration('running pub with --help after command shows command usage', () { |
| 63 schedulePub(args: ['install', '--help'], | 63 schedulePub(args: ['get', '--help'], |
| 64 output: ''' | 64 output: ''' |
| 65 Install the current package's dependencies. | 65 Get the current package's dependencies. |
| 66 | 66 |
| 67 Usage: pub install | 67 Usage: pub get |
| 68 -h, --help Print usage information for this command. | 68 -h, --help Print usage information for this command. |
| 69 --[no-]offline Use cached packages instead of accessing the net
work. | 69 --[no-]offline Use cached packages instead of accessing the net
work. |
| 70 '''); | 70 '''); |
| 71 }); | 71 }); |
| 72 | 72 |
| 73 integration('running pub with -h after command shows command usage', () { | 73 integration('running pub with -h after command shows command usage', () { |
| 74 schedulePub(args: ['install', '-h'], | 74 schedulePub(args: ['get', '-h'], |
| 75 output: ''' | 75 output: ''' |
| 76 Install the current package's dependencies. | 76 Get the current package's dependencies. |
| 77 | 77 |
| 78 Usage: pub install | 78 Usage: pub get |
| 79 -h, --help Print usage information for this command. | 79 -h, --help Print usage information for this command. |
| 80 --[no-]offline Use cached packages instead of accessing the net
work. | 80 --[no-]offline Use cached packages instead of accessing the net
work. |
| 81 '''); | 81 '''); |
| 82 }); | 82 }); |
| 83 | 83 |
| 84 integration('running pub with just --version displays version', () { | 84 integration('running pub with just --version displays version', () { |
| 85 schedulePub(args: ['--version'], output: VERSION_STRING); | 85 schedulePub(args: ['--version'], output: VERSION_STRING); |
| 86 }); | 86 }); |
| 87 | 87 |
| 88 integration('an unknown command displays an error message', () { | 88 integration('an unknown command displays an error message', () { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 109 schedulePub(args: ['version', '--blorf'], | 109 schedulePub(args: ['version', '--blorf'], |
| 110 error: ''' | 110 error: ''' |
| 111 Could not find an option named "blorf". | 111 Could not find an option named "blorf". |
| 112 Run "pub help" to see available options. | 112 Run "pub help" to see available options. |
| 113 ''', | 113 ''', |
| 114 exitCode: 64); | 114 exitCode: 64); |
| 115 }); | 115 }); |
| 116 | 116 |
| 117 group('help', () { | 117 group('help', () { |
| 118 integration('shows help for a command', () { | 118 integration('shows help for a command', () { |
| 119 schedulePub(args: ['help', 'install'], | 119 schedulePub(args: ['help', 'get'], |
| 120 output: ''' | 120 output: ''' |
| 121 Install the current package's dependencies. | 121 Get the current package's dependencies. |
| 122 | 122 |
| 123 Usage: pub install | 123 Usage: pub get |
| 124 -h, --help Print usage information for this command. | 124 -h, --help Print usage information for this command. |
| 125 --[no-]offline Use cached packages instead of accessing the n
etwork. | 125 --[no-]offline Use cached packages instead of accessing the n
etwork. |
| 126 '''); | 126 '''); |
| 127 }); | 127 }); |
| 128 | 128 |
| 129 integration('shows help for a command', () { | 129 integration('shows help for a command', () { |
| 130 schedulePub(args: ['help', 'publish'], | 130 schedulePub(args: ['help', 'publish'], |
| 131 output: ''' | 131 output: ''' |
| 132 Publish the current package to pub.dartlang.org. | 132 Publish the current package to pub.dartlang.org. |
| 133 | 133 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 // The "version" file generated on developer builds is a little funky and | 168 // The "version" file generated on developer builds is a little funky and |
| 169 // we need to make sure we don't choke on it. | 169 // we need to make sure we don't choke on it. |
| 170 d.dir(sdkPath, [ | 170 d.dir(sdkPath, [ |
| 171 d.file('version', '0.1.2.0_r16279_bobross'), | 171 d.file('version', '0.1.2.0_r16279_bobross'), |
| 172 ]).create(); | 172 ]).create(); |
| 173 | 173 |
| 174 schedulePub(args: ['version'], output: "Pub 0.1.2+0.r16279.bobross\n"); | 174 schedulePub(args: ['version'], output: "Pub 0.1.2+0.r16279.bobross\n"); |
| 175 }); | 175 }); |
| 176 }); | 176 }); |
| 177 } | 177 } |
| OLD | NEW |