| 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'); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 | 39 |
| 40 test('running pub with just -h displays usage', () => | 40 test('running pub with just -h displays usage', () => |
| 41 runPub(args: ['-h'], output: USAGE_STRING)); | 41 runPub(args: ['-h'], output: USAGE_STRING)); |
| 42 | 42 |
| 43 test('running pub with just --version displays version', () => | 43 test('running pub with just --version displays version', () => |
| 44 runPub(args: ['--version'], output: VERSION_STRING)); | 44 runPub(args: ['--version'], output: VERSION_STRING)); |
| 45 | 45 |
| 46 group('an unknown command', () { | 46 group('an unknown command', () { |
| 47 test('displays an error message', () { | 47 test('displays an error message', () { |
| 48 runPub(args: ['quylthulg'], | 48 runPub(args: ['quylthulg'], |
| 49 output: ''' | 49 error: ''' |
| 50 Unknown command "quylthulg". | 50 Unknown command "quylthulg". |
| 51 Run "pub help" to see available commands. | 51 Run "pub help" to see available commands. |
| 52 ''', | 52 ''', |
| 53 exitCode: 64); | 53 exitCode: 64); |
| 54 }); | 54 }); |
| 55 }); | 55 }); |
| 56 | 56 |
| 57 group('pub list', listCommand); | 57 group('pub list', listCommand); |
| 58 group('pub install', installCommand); | 58 group('pub install', installCommand); |
| 59 group('pub version', versionCommand); | 59 group('pub version', versionCommand); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 file('bar.dart', 'main() => "bar";'), | 136 file('bar.dart', 'main() => "bar";'), |
| 137 ]) | 137 ]) |
| 138 ]).scheduleValidate(); | 138 ]).scheduleValidate(); |
| 139 | 139 |
| 140 runPub(args: ['install'], | 140 runPub(args: ['install'], |
| 141 output: ''' | 141 output: ''' |
| 142 Dependencies installed! | 142 Dependencies installed! |
| 143 '''); | 143 '''); |
| 144 }); | 144 }); |
| 145 | 145 |
| 146 /* | |
| 147 test('checks out a package from Git', () { | 146 test('checks out a package from Git', () { |
| 148 git('foo.git', [ | 147 withGit(() { |
| 149 file('foo.dart', 'main() => "foo";') | 148 git('foo.git', [ |
| 150 ]).scheduleCreate(); | 149 file('foo.dart', 'main() => "foo";') |
| 150 ]).scheduleCreate(); |
| 151 | 151 |
| 152 dir(appPath, [ | 152 dir(appPath, [ |
| 153 file('pubspec', ''' | 153 file('pubspec', ''' |
| 154 dependencies: | 154 dependencies: |
| 155 foo: | 155 foo: |
| 156 git: ../foo.git | 156 git: ../foo.git |
| 157 ''') | 157 ''') |
| 158 ]).scheduleCreate(); | 158 ]).scheduleCreate(); |
| 159 | 159 |
| 160 dir(packagesPath, [ | 160 dir(packagesPath, [ |
| 161 dir('foo', [ | 161 dir('foo', [ |
| 162 file('foo.dart', 'main() => "foo";') | 162 file('foo.dart', 'main() => "foo";') |
| 163 ]) | 163 ]) |
| 164 ]).scheduleValidate(); | 164 ]).scheduleValidate(); |
| 165 | 165 |
| 166 runPub(args: ['install'], | 166 runPub(args: ['install'], |
| 167 output: const RegExp(@"Dependencies installed!$")); | 167 output: const RegExp(@"Dependencies installed!$")); |
| 168 }); |
| 168 }); | 169 }); |
| 169 | 170 |
| 170 test('checks out packages transitively from Git', () { | 171 test('checks out packages transitively from Git', () { |
| 171 git('foo.git', [ | 172 withGit(() { |
| 172 file('foo.dart', 'main() => "foo";'), | 173 git('foo.git', [ |
| 173 file('pubspec', ''' | 174 file('foo.dart', 'main() => "foo";'), |
| 175 file('pubspec', ''' |
| 174 dependencies: | 176 dependencies: |
| 175 bar: | 177 bar: |
| 176 git: ../bar.git | 178 git: ../bar.git |
| 177 ''') | 179 ''') |
| 178 ]).scheduleCreate(); | 180 ]).scheduleCreate(); |
| 179 | 181 |
| 180 git('bar.git', [ | 182 git('bar.git', [ |
| 181 file('bar.dart', 'main() => "bar";') | 183 file('bar.dart', 'main() => "bar";') |
| 182 ]).scheduleCreate(); | 184 ]).scheduleCreate(); |
| 183 | 185 |
| 184 dir(appPath, [ | 186 dir(appPath, [ |
| 185 file('pubspec', ''' | 187 file('pubspec', ''' |
| 186 dependencies: | 188 dependencies: |
| 187 foo: | 189 foo: |
| 188 git: ../foo.git | 190 git: ../foo.git |
| 189 ''') | 191 ''') |
| 190 ]).scheduleCreate(); | 192 ]).scheduleCreate(); |
| 191 | 193 |
| 192 dir(packagesPath, [ | 194 dir(packagesPath, [ |
| 193 dir('foo', [ | 195 dir('foo', [ |
| 194 file('foo.dart', 'main() => "foo";') | 196 file('foo.dart', 'main() => "foo";') |
| 195 ]), | 197 ]), |
| 196 dir('bar', [ | 198 dir('bar', [ |
| 197 file('bar.dart', 'main() => "bar";') | 199 file('bar.dart', 'main() => "bar";') |
| 198 ]) | 200 ]) |
| 199 ]).scheduleValidate(); | 201 ]).scheduleValidate(); |
| 200 | 202 |
| 201 runPub(args: ['install'], | 203 runPub(args: ['install'], |
| 202 output: const RegExp("Dependencies installed!\$")); | 204 output: const RegExp("Dependencies installed!\$")); |
| 205 }); |
| 203 }); | 206 }); |
| 204 */ | |
| 205 } | 207 } |
| 206 | 208 |
| 207 versionCommand() { | 209 versionCommand() { |
| 208 test('displays the current version', () => | 210 test('displays the current version', () => |
| 209 runPub(args: ['version'], output: VERSION_STRING)); | 211 runPub(args: ['version'], output: VERSION_STRING)); |
| 210 } | 212 } |
| OLD | NEW |