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: ['install'], | 29 schedulePub(args: ['install'], |
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('foo'), |
45 ]).scheduleCreate(); | 44 ]).scheduleCreate(); |
46 | 45 |
47 schedulePub(args: ['install'], | 46 schedulePub(args: ['install'], |
48 output: const RegExp(@"Dependencies installed!$")); | 47 output: const RegExp(@"Dependencies installed!$")); |
49 | 48 |
50 dir(packagesPath, [ | 49 dir(packagesPath, [ |
51 dir("myapp_name", [pubspec({"name": "myapp_name"})]) | 50 dir("myapp_name", [ |
| 51 file('foo.dart', 'main() => "foo";') |
| 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: ['install'], |
| 66 output: const RegExp(@"Dependencies installed!$")); |
| 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: ['install'], |
| 89 output: ''' |
| 90 Dependencies installed! |
| 91 '''); |
| 92 |
| 93 packagesDir({"foo": null}).scheduleValidate(); |
| 94 |
| 95 run(); |
| 96 }); |
57 | 97 |
58 group('creates a packages directory in', () { | 98 group('creates a packages directory in', () { |
59 test('"test/" and its subdirectories', () { | 99 test('"test/" and its subdirectories', () { |
60 dir(appPath, [ | 100 dir(appPath, [ |
61 appPubspec([]), | 101 appPubspec([]), |
| 102 libDir('foo'), |
62 dir("test", [dir("subtest")]) | 103 dir("test", [dir("subtest")]) |
63 ]).scheduleCreate(); | 104 ]).scheduleCreate(); |
64 | 105 |
65 schedulePub(args: ['install'], | 106 schedulePub(args: ['install'], |
66 output: const RegExp(@"Dependencies installed!$")); | 107 output: const RegExp(@"Dependencies installed!$")); |
67 | 108 |
68 dir(appPath, [ | 109 dir(appPath, [ |
69 dir("test", [ | 110 dir("test", [ |
70 dir("packages", [ | 111 dir("packages", [ |
71 // TODO(rnystrom): Re-enable this when #4820 is fixed. | 112 dir("myapp", [ |
72 /* | 113 file('foo.dart', 'main() => "foo";') |
73 dir("myapp", [appPubspec([])]) | 114 ]) |
74 */ | |
75 ]), | 115 ]), |
76 dir("subtest", [ | 116 dir("subtest", [ |
77 dir("packages", [ | 117 dir("packages", [ |
78 // TODO(rnystrom): Re-enable this when #4820 is fixed. | 118 dir("myapp", [ |
79 /* | 119 file('foo.dart', 'main() => "foo";') |
80 dir("myapp", [appPubspec([])]) | 120 ]) |
81 */ | |
82 ]) | 121 ]) |
83 ]) | 122 ]) |
84 ]) | 123 ]) |
85 ]).scheduleValidate(); | 124 ]).scheduleValidate(); |
86 | 125 |
87 run(); | 126 run(); |
88 }); | 127 }); |
89 | 128 |
90 test('"example/" and its subdirectories', () { | 129 test('"example/" and its subdirectories', () { |
91 dir(appPath, [ | 130 dir(appPath, [ |
92 appPubspec([]), | 131 appPubspec([]), |
| 132 libDir('foo'), |
93 dir("example", [dir("subexample")]) | 133 dir("example", [dir("subexample")]) |
94 ]).scheduleCreate(); | 134 ]).scheduleCreate(); |
95 | 135 |
96 schedulePub(args: ['install'], | 136 schedulePub(args: ['install'], |
97 output: const RegExp(@"Dependencies installed!$")); | 137 output: const RegExp(@"Dependencies installed!$")); |
98 | 138 |
99 dir(appPath, [ | 139 dir(appPath, [ |
100 dir("example", [ | 140 dir("example", [ |
101 dir("packages", [ | 141 dir("packages", [ |
102 // TODO(rnystrom): Re-enable this when #4820 is fixed. | 142 dir("myapp", [ |
103 /* | 143 file('foo.dart', 'main() => "foo";') |
104 dir("myapp", [appPubspec([])]) | 144 ]) |
105 */ | |
106 ]), | 145 ]), |
107 dir("subexample", [ | 146 dir("subexample", [ |
108 dir("packages", [ | 147 dir("packages", [ |
109 // TODO(rnystrom): Re-enable this when #4820 is fixed. | 148 dir("myapp", [ |
110 /* | 149 file('foo.dart', 'main() => "foo";') |
111 dir("myapp", [appPubspec([])]) | 150 ]) |
112 */ | |
113 ]) | 151 ]) |
114 ]) | 152 ]) |
115 ]) | 153 ]) |
116 ]).scheduleValidate(); | 154 ]).scheduleValidate(); |
117 | 155 |
118 run(); | 156 run(); |
119 }); | 157 }); |
120 | 158 |
121 test('"bin/"', () { | 159 test('"bin/"', () { |
122 dir(appPath, [ | 160 dir(appPath, [ |
123 appPubspec([]), | 161 appPubspec([]), |
| 162 libDir('foo'), |
124 dir("bin") | 163 dir("bin") |
125 ]).scheduleCreate(); | 164 ]).scheduleCreate(); |
126 | 165 |
127 schedulePub(args: ['install'], | 166 schedulePub(args: ['install'], |
128 output: const RegExp(@"Dependencies installed!$")); | 167 output: const RegExp(@"Dependencies installed!$")); |
129 | 168 |
130 dir(appPath, [ | 169 dir(appPath, [ |
131 dir("bin", [ | 170 dir("bin", [ |
132 dir("packages", [ | 171 dir("packages", [ |
133 // TODO(rnystrom): Re-enable this when #4820 is fixed. | 172 dir("myapp", [ |
134 /* | 173 file('foo.dart', 'main() => "foo";') |
135 dir("myapp", [appPubspec([])]) | 174 ]) |
136 */ | |
137 ]) | 175 ]) |
138 ]) | 176 ]) |
139 ]).scheduleValidate(); | 177 ]).scheduleValidate(); |
140 | 178 |
141 run(); | 179 run(); |
142 }); | 180 }); |
143 }); | 181 }); |
144 } | 182 } |
OLD | NEW |