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

Side by Side Diff: utils/tests/pub/pubspec_test.dart

Issue 10399076: Get codebase ready for actually supporting versioning. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Validate descriptions and move stuff into Entrypoint. Created 8 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
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 #library('source_test');
6
7 #import('../../../lib/unittest/unittest.dart');
8 #import('../../pub/pubspec.dart');
9 #import('../../pub/source.dart');
10 #import('../../pub/utils.dart');
11
12 class MockSource extends Source {
13 final String name = "mock";
14 final bool shouldCache = false;
15 void validateDescription(description) {
16 if (description != 'ok') throw new FormatException('Bad');
17 }
18 }
19
20 main() {
21 group('Pubspec', () {
22 group('parse()', () {
23 test("throws if the description isn't valid", () {
24 var sources = new SourceRegistry();
25 sources.register(new MockSource());
26
27 throwsBadFormat(() {
28 new Pubspec.parse('''
29 dependencies:
30 foo:
31 mock: bad
32 ''', sources);
33 });
34 });
35 });
36 });
37 }
38
39 throwsBadFormat(function) {
40 expectThrow(function, (e) => e is FormatException);
41 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698