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 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 }); | 414 }); |
415 }); | 415 }); |
416 | 416 |
417 group("publishTo", () { | 417 group("publishTo", () { |
418 test("defaults to null if omitted", () { | 418 test("defaults to null if omitted", () { |
419 var pubspec = new Pubspec.parse('', sources); | 419 var pubspec = new Pubspec.parse('', sources); |
420 expect(pubspec.publishTo, isNull); | 420 expect(pubspec.publishTo, isNull); |
421 }); | 421 }); |
422 | 422 |
423 test("throws if not a string", () { | 423 test("throws if not a string", () { |
424 expectPubspecException('publishTo: 123', | 424 expectPubspecException('publish_to: 123', |
425 (pubspec) => pubspec.publishTo); | 425 (pubspec) => pubspec.publishTo); |
426 }); | 426 }); |
427 | 427 |
428 test("allows a URL", () { | 428 test("allows a URL", () { |
429 var pubspec = new Pubspec.parse(''' | 429 var pubspec = new Pubspec.parse(''' |
430 publishTo: http://example.com | 430 publish_to: http://example.com |
431 ''', sources); | 431 ''', sources); |
432 expect(pubspec.publishTo, equals("http://example.com")); | 432 expect(pubspec.publishTo, equals("http://example.com")); |
433 }); | 433 }); |
434 | 434 |
435 test("allows none", () { | 435 test("allows none", () { |
436 var pubspec = new Pubspec.parse(''' | 436 var pubspec = new Pubspec.parse(''' |
437 publishTo: none | 437 publish_to: none |
438 ''', sources); | 438 ''', sources); |
439 expect(pubspec.publishTo, equals("none")); | 439 expect(pubspec.publishTo, equals("none")); |
440 }); | 440 }); |
441 | 441 |
442 test("throws on other strings", () { | 442 test("throws on other strings", () { |
443 expectPubspecException('publishTo: http://bad.url:not-port', | 443 expectPubspecException('publish_to: http://bad.url:not-port', |
444 (pubspec) => pubspec.publishTo); | 444 (pubspec) => pubspec.publishTo); |
445 }); | 445 }); |
446 }); | 446 }); |
447 }); | 447 }); |
448 } | 448 } |
OLD | NEW |