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

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

Issue 12036065: Make pub use the SDK's "version" file for its version. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Comment regex. Created 7 years, 11 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
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 '../../../pkg/unittest/lib/unittest.dart'; 10 import '../../../pkg/unittest/lib/unittest.dart';
(...skipping 20 matching lines...) Expand all
31 install Install the current package's dependencies. 31 install Install the current package's dependencies.
32 publish Publish the current package to pub.dartlang.org. 32 publish Publish the current package to pub.dartlang.org.
33 update Update the current package's dependencies to the latest version s. 33 update Update the current package's dependencies to the latest version s.
34 uploader Manage uploaders for a package on pub.dartlang.org. 34 uploader Manage uploaders for a package on pub.dartlang.org.
35 version Print pub version. 35 version Print pub version.
36 36
37 Use "pub help [command]" for more information about a command. 37 Use "pub help [command]" for more information about a command.
38 """; 38 """;
39 39
40 final VERSION_STRING = ''' 40 final VERSION_STRING = '''
41 Pub 0.0.0 41 Pub 0.1.2+3
42 '''; 42 ''';
43 43
44 main() { 44 main() {
45 test('running pub with no command displays usage', () => 45 integration('running pub with no command displays usage', () {
46 runPub(args: [], output: USAGE_STRING)); 46 schedulePub(args: [], output: USAGE_STRING);
47 });
47 48
48 test('running pub with just --help displays usage', () => 49 integration('running pub with just --help displays usage', () {
49 runPub(args: ['--help'], output: USAGE_STRING)); 50 schedulePub(args: ['--help'], output: USAGE_STRING);
51 });
50 52
51 test('running pub with just -h displays usage', () => 53 integration('running pub with just -h displays usage', () {
52 runPub(args: ['-h'], output: USAGE_STRING)); 54 schedulePub(args: ['-h'], output: USAGE_STRING);
55 });
53 56
54 test('running pub with just --version displays version', () => 57 integration('running pub with just --version displays version', () {
55 runPub(args: ['--version'], output: VERSION_STRING)); 58 dir(sdkPath, [
59 file('version', '0.1.2.3'),
60 ]).scheduleCreate();
56 61
57 test('an unknown command displays an error message', () { 62 schedulePub(args: ['--version'], output: VERSION_STRING);
58 runPub(args: ['quylthulg'], 63 });
64
65 integration('an unknown command displays an error message', () {
66 schedulePub(args: ['quylthulg'],
59 error: ''' 67 error: '''
60 Could not find a command named "quylthulg". 68 Could not find a command named "quylthulg".
61 Run "pub help" to see available commands. 69 Run "pub help" to see available commands.
62 ''', 70 ''',
63 exitCode: 64); 71 exitCode: 64);
64 }); 72 });
65 73
66 test('an unknown option displays an error message', () { 74 integration('an unknown option displays an error message', () {
67 runPub(args: ['--blorf'], 75 schedulePub(args: ['--blorf'],
68 error: ''' 76 error: '''
69 Could not find an option named "blorf". 77 Could not find an option named "blorf".
70 Run "pub help" to see available options. 78 Run "pub help" to see available options.
71 ''', 79 ''',
72 exitCode: 64); 80 exitCode: 64);
73 }); 81 });
74 82
75 test('an unknown command option displays an error message', () { 83 integration('an unknown command option displays an error message', () {
76 // TODO(rnystrom): When pub has command-specific options, a more precise 84 // TODO(rnystrom): When pub has command-specific options, a more precise
77 // error message would be good here. 85 // error message would be good here.
78 runPub(args: ['version', '--blorf'], 86 schedulePub(args: ['version', '--blorf'],
79 error: ''' 87 error: '''
80 Could not find an option named "blorf". 88 Could not find an option named "blorf".
81 Use "pub help" for more information. 89 Use "pub help" for more information.
82 ''', 90 ''',
83 exitCode: 64); 91 exitCode: 64);
84 }); 92 });
85 93
86 group('help', () { 94 group('help', () {
87 test('shows help for a command', () { 95 integration('shows help for a command', () {
88 runPub(args: ['help', 'install'], 96 schedulePub(args: ['help', 'install'],
89 output: ''' 97 output: '''
90 Install the current package's dependencies. 98 Install the current package's dependencies.
91 99
92 Usage: pub install 100 Usage: pub install
93 '''); 101 ''');
94 }); 102 });
95 103
96 test('shows help for a command', () { 104 integration('shows help for a command', () {
97 runPub(args: ['help', 'publish'], 105 schedulePub(args: ['help', 'publish'],
98 output: ''' 106 output: '''
99 Publish the current package to pub.dartlang.org. 107 Publish the current package to pub.dartlang.org.
100 108
101 Usage: pub publish [options] 109 Usage: pub publish [options]
102 --server The package server to which to upload this package 110 --server The package server to which to upload this package
103 (defaults to "https://pub.dartlang.org") 111 (defaults to "https://pub.dartlang.org")
104 '''); 112 ''');
105 }); 113 });
106 114
107 test('an unknown help command displays an error message', () { 115 integration('an unknown help command displays an error message', () {
108 runPub(args: ['help', 'quylthulg'], 116 schedulePub(args: ['help', 'quylthulg'],
109 error: ''' 117 error: '''
110 Could not find a command named "quylthulg". 118 Could not find a command named "quylthulg".
111 Run "pub help" to see available commands. 119 Run "pub help" to see available commands.
112 ''', 120 ''',
113 exitCode: 64); 121 exitCode: 64);
114 }); 122 });
115 123
116 }); 124 });
117 125
118 test('displays the current version', () => 126 integration('displays the current version', () {
119 runPub(args: ['version'], output: VERSION_STRING)); 127 dir(sdkPath, [
128 file('version', '0.1.2.3'),
129 ]).scheduleCreate();
130
131 schedulePub(args: ['version'], output: VERSION_STRING);
132 });
120 } 133 }
OLDNEW
« no previous file with comments | « utils/tests/pub/install/sdk/check_out_transitive_test.dart ('k') | utils/tests/pub/pub_uploader_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698