| 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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 file('pubspec.yaml', ''' | 161 file('pubspec.yaml', ''' |
| 162 dependencies: | 162 dependencies: |
| 163 foo: | 163 foo: |
| 164 git: ../foo.git | 164 git: ../foo.git |
| 165 ''') | 165 ''') |
| 166 ]).scheduleCreate(); | 166 ]).scheduleCreate(); |
| 167 | 167 |
| 168 schedulePub(args: ['install'], | 168 schedulePub(args: ['install'], |
| 169 output: const RegExp(@"Dependencies installed!$")); | 169 output: const RegExp(@"Dependencies installed!$")); |
| 170 | 170 |
| 171 dir(cachePath, [ |
| 172 dir('git', [ |
| 173 dir('cache', [ |
| 174 dir(new RegExp(@'foo-[a-f0-9]+'), [ |
| 175 file('foo.dart', 'main() => "foo";') |
| 176 ]) |
| 177 ]), |
| 178 dir(new RegExp(@'foo-[a-f0-9]+'), [ |
| 179 file('foo.dart', 'main() => "foo";') |
| 180 ]) |
| 181 ]) |
| 182 ]).scheduleValidate(); |
| 183 |
| 171 dir(packagesPath, [ | 184 dir(packagesPath, [ |
| 172 dir('foo', [ | 185 dir('foo', [ |
| 173 file('foo.dart', 'main() => "foo";') | 186 file('foo.dart', 'main() => "foo";') |
| 174 ]) | 187 ]) |
| 175 ]).scheduleValidate(); | 188 ]).scheduleValidate(); |
| 176 | 189 |
| 177 run(); | 190 run(); |
| 178 }); | 191 }); |
| 179 }); | 192 }); |
| 180 | 193 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 197 file('pubspec.yaml', ''' | 210 file('pubspec.yaml', ''' |
| 198 dependencies: | 211 dependencies: |
| 199 foo: | 212 foo: |
| 200 git: ../foo.git | 213 git: ../foo.git |
| 201 ''') | 214 ''') |
| 202 ]).scheduleCreate(); | 215 ]).scheduleCreate(); |
| 203 | 216 |
| 204 schedulePub(args: ['install'], | 217 schedulePub(args: ['install'], |
| 205 output: const RegExp("Dependencies installed!\$")); | 218 output: const RegExp("Dependencies installed!\$")); |
| 206 | 219 |
| 220 dir(cachePath, [ |
| 221 dir('git', [ |
| 222 dir('cache', [ |
| 223 dir(new RegExp(@'foo-[a-f0-9]+'), [ |
| 224 file('foo.dart', 'main() => "foo";') |
| 225 ]), |
| 226 dir(new RegExp(@'bar-[a-f0-9]+'), [ |
| 227 file('bar.dart', 'main() => "bar";') |
| 228 ]) |
| 229 ]), |
| 230 dir(new RegExp(@'foo-[a-f0-9]+'), [ |
| 231 file('foo.dart', 'main() => "foo";') |
| 232 ]), |
| 233 dir(new RegExp(@'bar-[a-f0-9]+'), [ |
| 234 file('bar.dart', 'main() => "bar";') |
| 235 ]) |
| 236 ]) |
| 237 ]).scheduleValidate(); |
| 238 |
| 207 dir(packagesPath, [ | 239 dir(packagesPath, [ |
| 208 dir('foo', [ | 240 dir('foo', [ |
| 209 file('foo.dart', 'main() => "foo";') | 241 file('foo.dart', 'main() => "foo";') |
| 210 ]), | 242 ]), |
| 211 dir('bar', [ | 243 dir('bar', [ |
| 212 file('bar.dart', 'main() => "bar";') | 244 file('bar.dart', 'main() => "bar";') |
| 213 ]) | 245 ]) |
| 214 ]).scheduleValidate(); | 246 ]).scheduleValidate(); |
| 215 | 247 |
| 216 run(); | 248 run(); |
| 217 }); | 249 }); |
| 218 }); | 250 }); |
| 219 | 251 |
| 252 test('checks out and updates a package from Git', () { |
| 253 withGit(() { |
| 254 git('foo.git', [ |
| 255 file('foo.dart', 'main() => "foo";') |
| 256 ]).scheduleCreate(); |
| 257 |
| 258 dir(appPath, [ |
| 259 file('pubspec.yaml', ''' |
| 260 dependencies: |
| 261 foo: |
| 262 git: ../foo.git |
| 263 ''') |
| 264 ]).scheduleCreate(); |
| 265 |
| 266 schedulePub(args: ['install'], |
| 267 output: const RegExp(@"Dependencies installed!$")); |
| 268 |
| 269 dir(cachePath, [ |
| 270 dir('git', [ |
| 271 dir('cache', [ |
| 272 dir(new RegExp(@'foo-[a-f0-9]+'), [ |
| 273 file('foo.dart', 'main() => "foo";') |
| 274 ]) |
| 275 ]), |
| 276 dir(new RegExp(@'foo-[a-f0-9]+'), [ |
| 277 file('foo.dart', 'main() => "foo";') |
| 278 ]) |
| 279 ]) |
| 280 ]).scheduleValidate(); |
| 281 |
| 282 dir(packagesPath, [ |
| 283 dir('foo', [ |
| 284 file('foo.dart', 'main() => "foo";') |
| 285 ]) |
| 286 ]).scheduleValidate(); |
| 287 |
| 288 // TODO(nweiz): remove this once we support pub update |
| 289 dir(packagesPath).scheduleDelete(); |
| 290 |
| 291 git('foo.git', [ |
| 292 file('foo.dart', 'main() => "foo 2";') |
| 293 ]).scheduleCommit(); |
| 294 |
| 295 schedulePub(args: ['install'], |
| 296 output: const RegExp(@"Dependencies installed!$")); |
| 297 |
| 298 // When we download a new version of the git package, we should re-use the |
| 299 // git/cache directory but create a new git/ directory. |
| 300 dir(cachePath, [ |
| 301 dir('git', [ |
| 302 dir('cache', [ |
| 303 dir(new RegExp(@'foo-[a-f0-9]+'), [ |
| 304 file('foo.dart', 'main() => "foo 2";') |
| 305 ]) |
| 306 ]), |
| 307 dir(new RegExp(@'foo-[a-f0-9]+'), [ |
| 308 file('foo.dart', 'main() => "foo";') |
| 309 ]), |
| 310 dir(new RegExp(@'foo-[a-f0-9]+'), [ |
| 311 file('foo.dart', 'main() => "foo 2";') |
| 312 ]) |
| 313 ]) |
| 314 ]).scheduleValidate(); |
| 315 |
| 316 dir(packagesPath, [ |
| 317 dir('foo', [ |
| 318 file('foo.dart', 'main() => "foo 2";') |
| 319 ]) |
| 320 ]).scheduleValidate(); |
| 321 |
| 322 run(); |
| 323 }); |
| 324 }); |
| 325 |
| 326 test('checks out a package from Git twice', () { |
| 327 withGit(() { |
| 328 git('foo.git', [ |
| 329 file('foo.dart', 'main() => "foo";') |
| 330 ]).scheduleCreate(); |
| 331 |
| 332 dir(appPath, [ |
| 333 file('pubspec.yaml', ''' |
| 334 dependencies: |
| 335 foo: |
| 336 git: ../foo.git |
| 337 ''') |
| 338 ]).scheduleCreate(); |
| 339 |
| 340 schedulePub(args: ['install'], |
| 341 output: const RegExp(@"Dependencies installed!$")); |
| 342 |
| 343 dir(cachePath, [ |
| 344 dir('git', [ |
| 345 dir('cache', [ |
| 346 dir(new RegExp(@'foo-[a-f0-9]+'), [ |
| 347 file('foo.dart', 'main() => "foo";') |
| 348 ]) |
| 349 ]), |
| 350 dir(new RegExp(@'foo-[a-f0-9]+'), [ |
| 351 file('foo.dart', 'main() => "foo";') |
| 352 ]) |
| 353 ]) |
| 354 ]).scheduleValidate(); |
| 355 |
| 356 dir(packagesPath, [ |
| 357 dir('foo', [ |
| 358 file('foo.dart', 'main() => "foo";') |
| 359 ]) |
| 360 ]).scheduleValidate(); |
| 361 |
| 362 // TODO(nweiz): remove this once we support pub update |
| 363 dir(packagesPath).scheduleDelete(); |
| 364 |
| 365 // Verify that nothing breaks if we install a Git revision that's already |
| 366 // in the cache. |
| 367 schedulePub(args: ['install'], |
| 368 output: const RegExp(@"Dependencies installed!$")); |
| 369 |
| 370 run(); |
| 371 }); |
| 372 }); |
| 373 |
| 220 test('checks out a package from a pub server', () { | 374 test('checks out a package from a pub server', () { |
| 221 servePackages("localhost", 3123, ['{name: foo, version: 1.2.3}']); | 375 servePackages("localhost", 3123, ['{name: foo, version: 1.2.3}']); |
| 222 | 376 |
| 223 dir(appPath, [ | 377 dir(appPath, [ |
| 224 file('pubspec.yaml', ''' | 378 file('pubspec.yaml', ''' |
| 225 dependencies: | 379 dependencies: |
| 226 foo: | 380 foo: |
| 227 repo: | 381 repo: |
| 228 name: foo | 382 name: foo |
| 229 url: http://localhost:3123 | 383 url: http://localhost:3123 |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 ]).scheduleValidate(); | 479 ]).scheduleValidate(); |
| 326 | 480 |
| 327 run(); | 481 run(); |
| 328 }); | 482 }); |
| 329 } | 483 } |
| 330 | 484 |
| 331 versionCommand() { | 485 versionCommand() { |
| 332 test('displays the current version', () => | 486 test('displays the current version', () => |
| 333 runPub(args: ['version'], output: VERSION_STRING)); | 487 runPub(args: ['version'], output: VERSION_STRING)); |
| 334 } | 488 } |
| OLD | NEW |