Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(348)

Side by Side Diff: sdk/lib/_internal/pub/test/pubspec_test.dart

Issue 15347004: Gracefully handle pubspecs with dependencies using unknown sources. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add tests for unknown sources in lockfiles. Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 'package:unittest/unittest.dart'; 7 import 'package:unittest/unittest.dart';
8 8
9 import '../lib/src/pubspec.dart'; 9 import '../lib/src/pubspec.dart';
10 import '../lib/src/source.dart'; 10 import '../lib/src/source.dart';
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 }); 74 });
75 75
76 test("allows an empty dev dependencies map", () { 76 test("allows an empty dev dependencies map", () {
77 var pubspec = new Pubspec.parse(null, ''' 77 var pubspec = new Pubspec.parse(null, '''
78 dev_dependencies: 78 dev_dependencies:
79 ''', sources); 79 ''', sources);
80 80
81 expect(pubspec.devDependencies, isEmpty); 81 expect(pubspec.devDependencies, isEmpty);
82 }); 82 });
83 83
84 test("allows an unknown source", () {
85 var pubspec = new Pubspec.parse(null, '''
86 dependencies:
87 foo:
88 unknown: blah
89 ''', sources);
90
91 var foo = pubspec.dependencies[0];
92 expect(foo.name, equals('foo'));
93 expect(foo.source, equals('unknown'));
94 });
95
84 test("throws if a package is in dependencies and dev_dependencies", () { 96 test("throws if a package is in dependencies and dev_dependencies", () {
85 expectFormatError(''' 97 expectFormatError('''
86 dependencies: 98 dependencies:
87 foo: 99 foo:
88 mock: ok 100 mock: ok
89 dev_dependencies: 101 dev_dependencies:
90 foo: 102 foo:
91 mock: ok 103 mock: ok
92 '''); 104 ''');
93 }); 105 });
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 215
204 test("throws if the sdk isn't a valid version constraint", () { 216 test("throws if the sdk isn't a valid version constraint", () {
205 expectFormatError(''' 217 expectFormatError('''
206 environment: 218 environment:
207 sdk: "oopies" 219 sdk: "oopies"
208 '''); 220 ''');
209 }); 221 });
210 }); 222 });
211 }); 223 });
212 } 224 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/pub/test/pub_cache_test.dart ('k') | sdk/lib/_internal/pub/test/test_pub.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698