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 pubspec_test; | 5 library pubspec_test; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 | 8 |
9 import 'package:unittest/unittest.dart'; | 9 import 'package:unittest/unittest.dart'; |
10 | 10 |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 | 332 |
333 test("allows a transformer from a normal dependency", () { | 333 test("allows a transformer from a normal dependency", () { |
334 var pubspec = new Pubspec.parse(''' | 334 var pubspec = new Pubspec.parse(''' |
335 name: pkg | 335 name: pkg |
336 dependencies: | 336 dependencies: |
337 foo: | 337 foo: |
338 mock: ok | 338 mock: ok |
339 transformers: | 339 transformers: |
340 - foo''', sources); | 340 - foo''', sources); |
341 | 341 |
342 expect(pubspec.transformers[0].single.package, equals("foo")); | 342 expect(pubspec.transformers[0].single.id.package, equals("foo")); |
343 }); | 343 }); |
344 | 344 |
345 test("allows a transformer from a dev dependency", () { | 345 test("allows a transformer from a dev dependency", () { |
346 var pubspec = new Pubspec.parse(''' | 346 var pubspec = new Pubspec.parse(''' |
347 name: pkg | 347 name: pkg |
348 dev_dependencies: | 348 dev_dependencies: |
349 foo: | 349 foo: |
350 mock: ok | 350 mock: ok |
351 transformers: | 351 transformers: |
352 - foo''', sources); | 352 - foo''', sources); |
353 | 353 |
354 expect(pubspec.transformers[0].single.package, equals("foo")); | 354 expect(pubspec.transformers[0].single.id.package, equals("foo")); |
355 }); | 355 }); |
356 | 356 |
357 test("allows a transformer from a dependency override", () { | 357 test("allows a transformer from a dependency override", () { |
358 var pubspec = new Pubspec.parse(''' | 358 var pubspec = new Pubspec.parse(''' |
359 name: pkg | 359 name: pkg |
360 dependency_overrides: | 360 dependency_overrides: |
361 foo: | 361 foo: |
362 mock: ok | 362 mock: ok |
363 transformers: | 363 transformers: |
364 - foo''', sources); | 364 - foo''', sources); |
365 | 365 |
366 expect(pubspec.transformers[0].single.package, equals("foo")); | 366 expect(pubspec.transformers[0].single.id.package, equals("foo")); |
367 }); | 367 }); |
368 | 368 |
369 test("allows comment-only files", () { | 369 test("allows comment-only files", () { |
370 var pubspec = new Pubspec.parse(''' | 370 var pubspec = new Pubspec.parse(''' |
371 # No external dependencies yet | 371 # No external dependencies yet |
372 # Including for completeness | 372 # Including for completeness |
373 # ...and hoping the spec expands to include details about author, version, etc | 373 # ...and hoping the spec expands to include details about author, version, etc |
374 # See http://www.dartlang.org/docs/pub-package-manager/ for details | 374 # See http://www.dartlang.org/docs/pub-package-manager/ for details |
375 ''', sources); | 375 ''', sources); |
376 expect(pubspec.version, equals(Version.none)); | 376 expect(pubspec.version, equals(Version.none)); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 (pubspec) => pubspec.environment); | 411 (pubspec) => pubspec.environment); |
412 }); | 412 }); |
413 | 413 |
414 test("throws if the sdk isn't a valid version constraint", () { | 414 test("throws if the sdk isn't a valid version constraint", () { |
415 expectPubspecException('environment: {sdk: "oopies"}', | 415 expectPubspecException('environment: {sdk: "oopies"}', |
416 (pubspec) => pubspec.environment); | 416 (pubspec) => pubspec.environment); |
417 }); | 417 }); |
418 }); | 418 }); |
419 }); | 419 }); |
420 } | 420 } |
OLD | NEW |