Chromium Code Reviews| 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 '../../../../pkg/pathos/lib/path.dart' as path; | |
| 9 import '../../../../pkg/unittest/lib/unittest.dart'; | 10 import '../../../../pkg/unittest/lib/unittest.dart'; |
| 11 | |
| 10 import '../test_pub.dart'; | 12 import '../test_pub.dart'; |
| 11 | 13 |
| 12 main() { | 14 main() { |
| 13 // Pub uses NTFS junction points to create links in the packages directory. | |
| 14 // These (unlike the symlinks that are supported in Vista and later) do not | |
| 15 // support relative paths. So this test, by design, will not pass on Windows. | |
| 16 // So just skip it. | |
| 17 if (Platform.operatingSystem == "windows") return; | |
| 18 | |
| 19 initConfig(); | 15 initConfig(); |
| 20 integration('uses a relative symlink for the self link', () { | 16 integration('replaces a broken "packages" symlink', () { |
| 21 dir(appPath, [ | |
| 22 appPubspec([]), | |
| 23 libDir('foo') | |
|
Andrei Mouravski
2013/03/06 01:25:46
Could you make all "s into 's?
Bob Nystrom
2013/03/06 20:55:55
Pub doesn't really have a well-defined guideline f
| |
| 24 ]).scheduleCreate(); | |
| 25 | |
| 26 schedulePub(args: ['install'], | |
| 27 output: new RegExp(r"Dependencies installed!$")); | |
| 28 | |
| 29 scheduleRename(appPath, "moved"); | |
| 30 | |
| 31 dir("moved", [ | |
| 32 dir("packages", [ | |
| 33 dir("myapp", [ | |
| 34 file('foo.dart', 'main() => "foo";') | |
| 35 ]) | |
| 36 ]) | |
| 37 ]).scheduleValidate(); | |
| 38 }); | |
| 39 | |
| 40 integration('uses a relative symlink for secondary packages directory', () { | |
| 41 dir(appPath, [ | 17 dir(appPath, [ |
| 42 appPubspec([]), | 18 appPubspec([]), |
| 43 libDir('foo'), | 19 libDir('foo'), |
| 44 dir("bin") | 20 dir("bin") |
| 45 ]).scheduleCreate(); | 21 ]).scheduleCreate(); |
| 46 | 22 |
| 23 // Create a broken "packages" symlink in "bin". | |
|
nweiz
2013/03/06 20:13:52
'"bin"' -> 'the package root'
| |
| 24 scheduleSymlink("nonexistent", path.join(appPath, "packages")); | |
| 25 | |
| 47 schedulePub(args: ['install'], | 26 schedulePub(args: ['install'], |
| 48 output: new RegExp(r"Dependencies installed!$")); | 27 output: new RegExp(r"Dependencies installed!$")); |
| 49 | 28 |
| 50 scheduleRename(appPath, "moved"); | 29 dir(appPath, [ |
| 51 | |
| 52 dir("moved", [ | |
| 53 dir("bin", [ | 30 dir("bin", [ |
| 54 dir("packages", [ | 31 dir("packages", [ |
| 55 dir("myapp", [ | 32 dir("myapp", [ |
| 33 file('foo.dart', 'main() => "foo";') | |
| 34 ]) | |
| 35 ]) | |
| 36 ]) | |
| 37 ]).scheduleValidate(); | |
| 38 }); | |
| 39 | |
| 40 integration('replaces a broken secondary "packages" symlink', () { | |
| 41 dir(appPath, [ | |
| 42 appPubspec([]), | |
| 43 libDir('foo'), | |
| 44 dir("bin") | |
| 45 ]).scheduleCreate(); | |
| 46 | |
| 47 // Create a broken "packages" symlink in "bin". | |
| 48 scheduleSymlink("nonexistent", path.join(appPath, "bin", "packages")); | |
| 49 | |
| 50 schedulePub(args: ['install'], | |
| 51 output: new RegExp(r"Dependencies installed!$")); | |
| 52 | |
| 53 dir(appPath, [ | |
| 54 dir("bin", [ | |
| 55 dir("packages", [ | |
| 56 dir("myapp", [ | |
| 56 file('foo.dart', 'main() => "foo";') | 57 file('foo.dart', 'main() => "foo";') |
| 57 ]) | 58 ]) |
| 58 ]) | 59 ]) |
| 59 ]) | 60 ]) |
| 60 ]).scheduleValidate(); | 61 ]).scheduleValidate(); |
| 61 }); | 62 }); |
| 62 } | 63 } |
| OLD | NEW |