| 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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 ]), | 197 ]), |
| 198 dir('bar', [ | 198 dir('bar', [ |
| 199 file('bar.dart', 'main() => "bar";') | 199 file('bar.dart', 'main() => "bar";') |
| 200 ]) | 200 ]) |
| 201 ]).scheduleValidate(); | 201 ]).scheduleValidate(); |
| 202 | 202 |
| 203 runPub(args: ['install'], | 203 runPub(args: ['install'], |
| 204 output: const RegExp("Dependencies installed!\$")); | 204 output: const RegExp("Dependencies installed!\$")); |
| 205 }); | 205 }); |
| 206 }); | 206 }); |
| 207 | |
| 208 test('checks out a package from a pub server', () { | |
| 209 servePackages("localhost", 3123, ['{name: foo, version: 1.2.3}']); | |
| 210 | |
| 211 dir(appPath, [ | |
| 212 file('pubspec.yaml', ''' | |
| 213 dependencies: | |
| 214 foo: | |
| 215 repo: | |
| 216 name: foo | |
| 217 url: http://localhost:3123 | |
| 218 version: 1.2.3 | |
| 219 ''') | |
| 220 ]).scheduleCreate(); | |
| 221 | |
| 222 dir(cachePath, [ | |
| 223 dir('repo', [ | |
| 224 dir('localhost%583123', [ | |
| 225 dir('foo-1.2.3', [ | |
| 226 file('pubspec.yaml', '{name: foo, version: 1.2.3}'), | |
| 227 file('foo.dart', 'main() => print("foo 1.2.3");') | |
| 228 ]) | |
| 229 ]) | |
| 230 ]) | |
| 231 ]).scheduleValidate(); | |
| 232 | |
| 233 dir(packagesPath, [ | |
| 234 dir('foo', [ | |
| 235 file('pubspec.yaml', '{name: foo, version: 1.2.3}'), | |
| 236 file('foo.dart', 'main() => print("foo 1.2.3");') | |
| 237 ]) | |
| 238 ]).scheduleValidate(); | |
| 239 | |
| 240 runPub(args: ['install'], | |
| 241 output: const RegExp("Dependencies installed!\$")); | |
| 242 }); | |
| 243 | |
| 244 test('checks out packages transitively from a pub server', () { | |
| 245 servePackages("localhost", 3123, [ | |
| 246 ''' | |
| 247 name: foo | |
| 248 version: 1.2.3 | |
| 249 dependencies: | |
| 250 bar: | |
| 251 repo: {name: bar, url: http://localhost:3123} | |
| 252 version: 2.0.4 | |
| 253 ''', | |
| 254 '{name: bar, version: 2.0.3}', | |
| 255 '{name: bar, version: 2.0.4}', | |
| 256 '{name: bar, version: 2.0.5}', | |
| 257 ]); | |
| 258 | |
| 259 dir(appPath, [ | |
| 260 file('pubspec.yaml', ''' | |
| 261 dependencies: | |
| 262 foo: | |
| 263 repo: | |
| 264 name: foo | |
| 265 url: http://localhost:3123 | |
| 266 version: 1.2.3 | |
| 267 ''') | |
| 268 ]).scheduleCreate(); | |
| 269 | |
| 270 dir(cachePath, [ | |
| 271 dir('repo', [ | |
| 272 dir('localhost%583123', [ | |
| 273 dir('foo-1.2.3', [ | |
| 274 file('pubspec.yaml', ''' | |
| 275 name: foo | |
| 276 version: 1.2.3 | |
| 277 dependencies: | |
| 278 bar: | |
| 279 repo: {name: bar, url: http://localhost:3123} | |
| 280 version: 2.0.4 | |
| 281 '''), | |
| 282 file('foo.dart', 'main() => print("foo 1.2.3");') | |
| 283 ]), | |
| 284 dir('bar-2.0.4', [ | |
| 285 file('pubspec.yaml', '{name: bar, version: 2.0.4}'), | |
| 286 file('bar.dart', 'main() => print("bar 2.0.4");') | |
| 287 ]) | |
| 288 ]) | |
| 289 ]) | |
| 290 ]).scheduleValidate(); | |
| 291 | |
| 292 dir(packagesPath, [ | |
| 293 dir('foo', [ | |
| 294 file('pubspec.yaml', ''' | |
| 295 name: foo | |
| 296 version: 1.2.3 | |
| 297 dependencies: | |
| 298 bar: | |
| 299 repo: {name: bar, url: http://localhost:3123} | |
| 300 version: 2.0.4 | |
| 301 '''), | |
| 302 file('foo.dart', 'main() => print("foo 1.2.3");') | |
| 303 ]), | |
| 304 dir('bar', [ | |
| 305 file('pubspec.yaml', '{name: bar, version: 2.0.4}'), | |
| 306 file('bar.dart', 'main() => print("bar 2.0.4");') | |
| 307 ]) | |
| 308 ]).scheduleValidate(); | |
| 309 | |
| 310 runPub(args: ['install'], | |
| 311 output: const RegExp("Dependencies installed!\$")); | |
| 312 }); | |
| 313 } | 207 } |
| 314 | 208 |
| 315 versionCommand() { | 209 versionCommand() { |
| 316 test('displays the current version', () => | 210 test('displays the current version', () => |
| 317 runPub(args: ['version'], output: VERSION_STRING)); | 211 runPub(args: ['version'], output: VERSION_STRING)); |
| 318 } | 212 } |
| OLD | NEW |