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('../../../pkg/unittest/unittest.dart'); | 10 #import('../../../pkg/unittest/unittest.dart'); |
(...skipping 17 matching lines...) Expand all Loading... |
28 | 28 |
29 schedulePub(args: ['update'], | 29 schedulePub(args: ['update'], |
30 error: const RegExp(@'^"pubspec.yaml" is missing the required "name" ' | 30 error: const RegExp(@'^"pubspec.yaml" is missing the required "name" ' |
31 @'field \(e\.g\. "name: myapp"\)\.'), | 31 @'field \(e\.g\. "name: myapp"\)\.'), |
32 exitCode: 1); | 32 exitCode: 1); |
33 | 33 |
34 run(); | 34 run(); |
35 }); | 35 }); |
36 }); | 36 }); |
37 | 37 |
38 // TODO(rnystrom): Re-enable this when #4820 is fixed. | 38 test('adds itself to the packages', () { |
39 /* | |
40 test('creates a self-referential symlink', () { | |
41 // The symlink should use the name in the pubspec, not the name of the | 39 // The symlink should use the name in the pubspec, not the name of the |
42 // directory. | 40 // directory. |
43 dir(appPath, [ | 41 dir(appPath, [ |
44 pubspec({"name": "myapp_name"}) | 42 pubspec({"name": "myapp_name"}), |
| 43 libDir('myapp_name') |
45 ]).scheduleCreate(); | 44 ]).scheduleCreate(); |
46 | 45 |
47 schedulePub(args: ['update'], | 46 schedulePub(args: ['update'], |
48 output: const RegExp(@"Dependencies updated!$")); | 47 output: const RegExp(@"Dependencies updated!$")); |
49 | 48 |
50 dir(packagesPath, [ | 49 dir(packagesPath, [ |
51 dir("myapp_name", [pubspec({"name": "myapp_name"})]) | 50 dir("myapp_name", [ |
| 51 file('myapp_name.dart', 'main() => "myapp_name";') |
| 52 ]) |
52 ]).scheduleValidate(); | 53 ]).scheduleValidate(); |
53 | 54 |
54 run(); | 55 run(); |
55 }); | 56 }); |
56 */ | 57 |
| 58 test('does not adds itself to the packages if it has no "lib" directory', () { |
| 59 // The symlink should use the name in the pubspec, not the name of the |
| 60 // directory. |
| 61 dir(appPath, [ |
| 62 pubspec({"name": "myapp_name"}), |
| 63 ]).scheduleCreate(); |
| 64 |
| 65 schedulePub(args: ['update'], |
| 66 output: const RegExp(@"Dependencies updated!$")); |
| 67 |
| 68 dir(packagesPath, [ |
| 69 nothing("myapp_name") |
| 70 ]).scheduleValidate(); |
| 71 |
| 72 run(); |
| 73 }); |
| 74 |
| 75 test('does not add a package if it does not have a "lib" directory', () { |
| 76 // Using an SDK source, but this should be true of all sources. |
| 77 dir(sdkPath, [ |
| 78 file('revision', '1234'), |
| 79 dir('pkg', [ |
| 80 dir('foo', []) |
| 81 ]) |
| 82 ]).scheduleCreate(); |
| 83 |
| 84 dir(appPath, [ |
| 85 pubspec({"name": "myapp", "dependencies": {"foo": {"sdk": "foo"}}}) |
| 86 ]).scheduleCreate(); |
| 87 |
| 88 schedulePub(args: ['update'], |
| 89 output: ''' |
| 90 Dependencies updated! |
| 91 '''); |
| 92 |
| 93 packagesDir({"foo": null}).scheduleValidate(); |
| 94 |
| 95 run(); |
| 96 }); |
57 } | 97 } |
OLD | NEW |