| 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 dir('foo', [ | 92 dir('foo', [ |
| 93 file('foo.dart', 'main() => "foo";') | 93 file('foo.dart', 'main() => "foo";') |
| 94 ]) | 94 ]) |
| 95 ]) | 95 ]) |
| 96 ]).scheduleCreate(); | 96 ]).scheduleCreate(); |
| 97 | 97 |
| 98 dir(appPath, [ | 98 dir(appPath, [ |
| 99 file('pubspec.yaml', 'dependencies:\n foo:') | 99 file('pubspec.yaml', 'dependencies:\n foo:') |
| 100 ]).scheduleCreate(); | 100 ]).scheduleCreate(); |
| 101 | 101 |
| 102 schedulePub(args: ['install'], |
| 103 output: ''' |
| 104 Dependencies installed! |
| 105 '''); |
| 106 |
| 102 dir(packagesPath, [ | 107 dir(packagesPath, [ |
| 103 dir('foo', [ | 108 dir('foo', [ |
| 104 file('foo.dart', 'main() => "foo";') | 109 file('foo.dart', 'main() => "foo";') |
| 105 ]) | 110 ]) |
| 106 ]).scheduleValidate(); | 111 ]).scheduleValidate(); |
| 107 | 112 |
| 108 runPub(args: ['install'], | 113 run(); |
| 109 output: ''' | |
| 110 Dependencies installed! | |
| 111 '''); | |
| 112 }); | 114 }); |
| 113 | 115 |
| 114 test('adds a transitively dependent package', () { | 116 test('adds a transitively dependent package', () { |
| 115 dir(sdkPath, [ | 117 dir(sdkPath, [ |
| 116 dir('lib', [ | 118 dir('lib', [ |
| 117 dir('foo', [ | 119 dir('foo', [ |
| 118 file('foo.dart', 'main() => "foo";'), | 120 file('foo.dart', 'main() => "foo";'), |
| 119 file('pubspec.yaml', 'dependencies:\n bar:') | 121 file('pubspec.yaml', 'dependencies:\n bar:') |
| 120 ]), | 122 ]), |
| 121 dir('bar', [ | 123 dir('bar', [ |
| 122 file('bar.dart', 'main() => "bar";'), | 124 file('bar.dart', 'main() => "bar";'), |
| 123 ]) | 125 ]) |
| 124 ]) | 126 ]) |
| 125 ]).scheduleCreate(); | 127 ]).scheduleCreate(); |
| 126 | 128 |
| 127 dir(appPath, [ | 129 dir(appPath, [ |
| 128 file('pubspec.yaml', 'dependencies:\n foo:') | 130 file('pubspec.yaml', 'dependencies:\n foo:') |
| 129 ]).scheduleCreate(); | 131 ]).scheduleCreate(); |
| 130 | 132 |
| 133 schedulePub(args: ['install'], |
| 134 output: ''' |
| 135 Dependencies installed! |
| 136 '''); |
| 137 |
| 131 dir(packagesPath, [ | 138 dir(packagesPath, [ |
| 132 dir('foo', [ | 139 dir('foo', [ |
| 133 file('foo.dart', 'main() => "foo";') | 140 file('foo.dart', 'main() => "foo";') |
| 134 ]), | 141 ]), |
| 135 dir('bar', [ | 142 dir('bar', [ |
| 136 file('bar.dart', 'main() => "bar";'), | 143 file('bar.dart', 'main() => "bar";'), |
| 137 ]) | 144 ]) |
| 138 ]).scheduleValidate(); | 145 ]).scheduleValidate(); |
| 139 | 146 |
| 140 runPub(args: ['install'], | 147 run(); |
| 141 output: ''' | |
| 142 Dependencies installed! | |
| 143 '''); | |
| 144 }); | 148 }); |
| 145 | 149 |
| 146 test('checks out a package from Git', () { | 150 test('checks out a package from Git', () { |
| 147 withGit(() { | 151 withGit(() { |
| 148 git('foo.git', [ | 152 git('foo.git', [ |
| 149 file('foo.dart', 'main() => "foo";') | 153 file('foo.dart', 'main() => "foo";') |
| 150 ]).scheduleCreate(); | 154 ]).scheduleCreate(); |
| 151 | 155 |
| 152 dir(appPath, [ | 156 dir(appPath, [ |
| 153 file('pubspec.yaml', ''' | 157 file('pubspec.yaml', ''' |
| 154 dependencies: | 158 dependencies: |
| 155 foo: | 159 foo: |
| 156 git: ../foo.git | 160 git: ../foo.git |
| 157 ''') | 161 ''') |
| 158 ]).scheduleCreate(); | 162 ]).scheduleCreate(); |
| 159 | 163 |
| 164 schedulePub(args: ['install'], |
| 165 output: const RegExp(@"Dependencies installed!$")); |
| 166 |
| 160 dir(packagesPath, [ | 167 dir(packagesPath, [ |
| 161 dir('foo', [ | 168 dir('foo', [ |
| 162 file('foo.dart', 'main() => "foo";') | 169 file('foo.dart', 'main() => "foo";') |
| 163 ]) | 170 ]) |
| 164 ]).scheduleValidate(); | 171 ]).scheduleValidate(); |
| 165 | 172 |
| 166 runPub(args: ['install'], | 173 run(); |
| 167 output: const RegExp(@"Dependencies installed!$")); | |
| 168 }); | 174 }); |
| 169 }); | 175 }); |
| 170 | 176 |
| 171 test('checks out packages transitively from Git', () { | 177 test('checks out packages transitively from Git', () { |
| 172 withGit(() { | 178 withGit(() { |
| 173 git('foo.git', [ | 179 git('foo.git', [ |
| 174 file('foo.dart', 'main() => "foo";'), | 180 file('foo.dart', 'main() => "foo";'), |
| 175 file('pubspec.yaml', ''' | 181 file('pubspec.yaml', ''' |
| 176 dependencies: | 182 dependencies: |
| 177 bar: | 183 bar: |
| 178 git: ../bar.git | 184 git: ../bar.git |
| 179 ''') | 185 ''') |
| 180 ]).scheduleCreate(); | 186 ]).scheduleCreate(); |
| 181 | 187 |
| 182 git('bar.git', [ | 188 git('bar.git', [ |
| 183 file('bar.dart', 'main() => "bar";') | 189 file('bar.dart', 'main() => "bar";') |
| 184 ]).scheduleCreate(); | 190 ]).scheduleCreate(); |
| 185 | 191 |
| 186 dir(appPath, [ | 192 dir(appPath, [ |
| 187 file('pubspec.yaml', ''' | 193 file('pubspec.yaml', ''' |
| 188 dependencies: | 194 dependencies: |
| 189 foo: | 195 foo: |
| 190 git: ../foo.git | 196 git: ../foo.git |
| 191 ''') | 197 ''') |
| 192 ]).scheduleCreate(); | 198 ]).scheduleCreate(); |
| 193 | 199 |
| 200 schedulePub(args: ['install'], |
| 201 output: const RegExp("Dependencies installed!\$")); |
| 202 |
| 194 dir(packagesPath, [ | 203 dir(packagesPath, [ |
| 195 dir('foo', [ | 204 dir('foo', [ |
| 196 file('foo.dart', 'main() => "foo";') | 205 file('foo.dart', 'main() => "foo";') |
| 197 ]), | 206 ]), |
| 198 dir('bar', [ | 207 dir('bar', [ |
| 199 file('bar.dart', 'main() => "bar";') | 208 file('bar.dart', 'main() => "bar";') |
| 200 ]) | 209 ]) |
| 201 ]).scheduleValidate(); | 210 ]).scheduleValidate(); |
| 202 | 211 |
| 203 runPub(args: ['install'], | 212 run(); |
| 204 output: const RegExp("Dependencies installed!\$")); | |
| 205 }); | 213 }); |
| 206 }); | 214 }); |
| 207 | 215 |
| 208 test('checks out a package from a pub server', () { | 216 test('checks out a package from a pub server', () { |
| 209 servePackages("localhost", 3123, ['{name: foo, version: 1.2.3}']); | 217 servePackages("localhost", 3123, ['{name: foo, version: 1.2.3}']); |
| 210 | 218 |
| 211 dir(appPath, [ | 219 dir(appPath, [ |
| 212 file('pubspec.yaml', ''' | 220 file('pubspec.yaml', ''' |
| 213 dependencies: | 221 dependencies: |
| 214 foo: | 222 foo: |
| 215 repo: | 223 repo: |
| 216 name: foo | 224 name: foo |
| 217 url: http://localhost:3123 | 225 url: http://localhost:3123 |
| 218 version: 1.2.3 | 226 version: 1.2.3 |
| 219 ''') | 227 ''') |
| 220 ]).scheduleCreate(); | 228 ]).scheduleCreate(); |
| 221 | 229 |
| 230 schedulePub(args: ['install'], |
| 231 output: const RegExp("Dependencies installed!\$")); |
| 232 |
| 222 dir(cachePath, [ | 233 dir(cachePath, [ |
| 223 dir('repo', [ | 234 dir('repo', [ |
| 224 dir('localhost%583123', [ | 235 dir('localhost%583123', [ |
| 225 dir('foo-1.2.3', [ | 236 dir('foo-1.2.3', [ |
| 226 file('pubspec.yaml', '{name: foo, version: 1.2.3}'), | 237 file('pubspec.yaml', '{name: foo, version: 1.2.3}'), |
| 227 file('foo.dart', 'main() => print("foo 1.2.3");') | 238 file('foo.dart', 'main() => print("foo 1.2.3");') |
| 228 ]) | 239 ]) |
| 229 ]) | 240 ]) |
| 230 ]) | 241 ]) |
| 231 ]).scheduleValidate(); | 242 ]).scheduleValidate(); |
| 232 | 243 |
| 233 dir(packagesPath, [ | 244 dir(packagesPath, [ |
| 234 dir('foo', [ | 245 dir('foo', [ |
| 235 file('pubspec.yaml', '{name: foo, version: 1.2.3}'), | 246 file('pubspec.yaml', '{name: foo, version: 1.2.3}'), |
| 236 file('foo.dart', 'main() => print("foo 1.2.3");') | 247 file('foo.dart', 'main() => print("foo 1.2.3");') |
| 237 ]) | 248 ]) |
| 238 ]).scheduleValidate(); | 249 ]).scheduleValidate(); |
| 239 | 250 |
| 240 runPub(args: ['install'], | 251 run(); |
| 241 output: const RegExp("Dependencies installed!\$")); | |
| 242 }); | 252 }); |
| 243 | 253 |
| 244 test('checks out packages transitively from a pub server', () { | 254 test('checks out packages transitively from a pub server', () { |
| 245 servePackages("localhost", 3123, [ | 255 servePackages("localhost", 3123, [ |
| 246 ''' | 256 ''' |
| 247 name: foo | 257 name: foo |
| 248 version: 1.2.3 | 258 version: 1.2.3 |
| 249 dependencies: | 259 dependencies: |
| 250 bar: | 260 bar: |
| 251 repo: {name: bar, url: http://localhost:3123} | 261 repo: {name: bar, url: http://localhost:3123} |
| 252 version: 2.0.4 | 262 version: 2.0.4 |
| 253 ''', | 263 ''', |
| 254 '{name: bar, version: 2.0.3}', | 264 '{name: bar, version: 2.0.3}', |
| 255 '{name: bar, version: 2.0.4}', | 265 '{name: bar, version: 2.0.4}', |
| 256 '{name: bar, version: 2.0.5}', | 266 '{name: bar, version: 2.0.5}', |
| 257 ]); | 267 ]); |
| 258 | 268 |
| 259 dir(appPath, [ | 269 dir(appPath, [ |
| 260 file('pubspec.yaml', ''' | 270 file('pubspec.yaml', ''' |
| 261 dependencies: | 271 dependencies: |
| 262 foo: | 272 foo: |
| 263 repo: | 273 repo: |
| 264 name: foo | 274 name: foo |
| 265 url: http://localhost:3123 | 275 url: http://localhost:3123 |
| 266 version: 1.2.3 | 276 version: 1.2.3 |
| 267 ''') | 277 ''') |
| 268 ]).scheduleCreate(); | 278 ]).scheduleCreate(); |
| 269 | 279 |
| 280 schedulePub(args: ['install'], |
| 281 output: const RegExp("Dependencies installed!\$")); |
| 282 |
| 270 dir(cachePath, [ | 283 dir(cachePath, [ |
| 271 dir('repo', [ | 284 dir('repo', [ |
| 272 dir('localhost%583123', [ | 285 dir('localhost%583123', [ |
| 273 dir('foo-1.2.3', [ | 286 dir('foo-1.2.3', [ |
| 274 file('pubspec.yaml', ''' | 287 file('pubspec.yaml', ''' |
| 275 name: foo | 288 name: foo |
| 276 version: 1.2.3 | 289 version: 1.2.3 |
| 277 dependencies: | 290 dependencies: |
| 278 bar: | 291 bar: |
| 279 repo: {name: bar, url: http://localhost:3123} | 292 repo: {name: bar, url: http://localhost:3123} |
| (...skipping 20 matching lines...) Expand all Loading... |
| 300 version: 2.0.4 | 313 version: 2.0.4 |
| 301 '''), | 314 '''), |
| 302 file('foo.dart', 'main() => print("foo 1.2.3");') | 315 file('foo.dart', 'main() => print("foo 1.2.3");') |
| 303 ]), | 316 ]), |
| 304 dir('bar', [ | 317 dir('bar', [ |
| 305 file('pubspec.yaml', '{name: bar, version: 2.0.4}'), | 318 file('pubspec.yaml', '{name: bar, version: 2.0.4}'), |
| 306 file('bar.dart', 'main() => print("bar 2.0.4");') | 319 file('bar.dart', 'main() => print("bar 2.0.4");') |
| 307 ]) | 320 ]) |
| 308 ]).scheduleValidate(); | 321 ]).scheduleValidate(); |
| 309 | 322 |
| 310 runPub(args: ['install'], | 323 run(); |
| 311 output: const RegExp("Dependencies installed!\$")); | |
| 312 }); | 324 }); |
| 313 } | 325 } |
| 314 | 326 |
| 315 versionCommand() { | 327 versionCommand() { |
| 316 test('displays the current version', () => | 328 test('displays the current version', () => |
| 317 runPub(args: ['version'], output: VERSION_STRING)); | 329 runPub(args: ['version'], output: VERSION_STRING)); |
| 318 } | 330 } |
| OLD | NEW |