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

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

Issue 10541039: Update pub to new expect API. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 6 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
« no previous file with comments | « no previous file | utils/tests/pub/version_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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('lock_file_test'); 5 #library('lock_file_test');
6 6
7 #import('../../../lib/unittest/unittest.dart'); 7 #import('../../../lib/unittest/unittest.dart');
8 #import('../../pub/lock_file.dart'); 8 #import('../../pub/lock_file.dart');
9 #import('../../pub/package.dart'); 9 #import('../../pub/package.dart');
10 #import('../../pub/source.dart'); 10 #import('../../pub/source.dart');
(...skipping 15 matching lines...) Expand all
26 26
27 main() { 27 main() {
28 var sources = new SourceRegistry(); 28 var sources = new SourceRegistry();
29 var mockSource = new MockSource(); 29 var mockSource = new MockSource();
30 sources.register(mockSource); 30 sources.register(mockSource);
31 31
32 group('LockFile', () { 32 group('LockFile', () {
33 group('parse()', () { 33 group('parse()', () {
34 test('returns an empty lockfile if the contents are empty', () { 34 test('returns an empty lockfile if the contents are empty', () {
35 var lockFile = new LockFile.parse('', sources); 35 var lockFile = new LockFile.parse('', sources);
36 expect(lockFile.packages.length).equals(0); 36 expect(lockFile.packages.length, equals(0));
gram 2012/06/06 22:48:29 isZero?
37 }); 37 });
38 38
39 test('returns an empty lockfile if the contents are whitespace', () { 39 test('returns an empty lockfile if the contents are whitespace', () {
40 var lockFile = new LockFile.parse(' \t\n ', sources); 40 var lockFile = new LockFile.parse(' \t\n ', sources);
41 expect(lockFile.packages.length).equals(0); 41 expect(lockFile.packages.length, equals(0));
42 }); 42 });
43 43
44 test('parses a series of package descriptions', () { 44 test('parses a series of package descriptions', () {
45 var lockFile = new LockFile.parse(''' 45 var lockFile = new LockFile.parse('''
46 packages: 46 packages:
47 bar: 47 bar:
48 version: 1.2.3 48 version: 1.2.3
49 source: mock 49 source: mock
50 description: bar desc 50 description: bar desc
51 foo: 51 foo:
52 version: 2.3.4 52 version: 2.3.4
53 source: mock 53 source: mock
54 description: foo desc 54 description: foo desc
55 ''', sources); 55 ''', sources);
56 56
57 expect(lockFile.packages.length).equals(2); 57 expect(lockFile.packages.length, equals(2));
58 58
59 var bar = lockFile.packages['bar']; 59 var bar = lockFile.packages['bar'];
60 expect(bar.name).equals('bar'); 60 expect(bar.name, equals('bar'));
61 expect(bar.version).equals(new Version(1, 2, 3)); 61 expect(bar.version, equals(new Version(1, 2, 3)));
62 expect(bar.source).equals(mockSource); 62 expect(bar.source, equals(mockSource));
63 expect(bar.description).equals('bar desc'); 63 expect(bar.description, equals('bar desc'));
64 64
65 var foo = lockFile.packages['foo']; 65 var foo = lockFile.packages['foo'];
66 expect(foo.name).equals('foo'); 66 expect(foo.name, equals('foo'));
67 expect(foo.version).equals(new Version(2, 3, 4)); 67 expect(foo.version, equals(new Version(2, 3, 4)));
68 expect(foo.source).equals(mockSource); 68 expect(foo.source, equals(mockSource));
69 expect(foo.description).equals('foo desc'); 69 expect(foo.description, equals('foo desc'));
70 }); 70 });
71 71
72 test("throws if the version is missing", () { 72 test("throws if the version is missing", () {
73 throwsBadFormat(() { 73 throwsBadFormat(() {
74 new LockFile.parse(''' 74 new LockFile.parse('''
75 packages: 75 packages:
76 foo: 76 foo:
77 source: mock 77 source: mock
78 description: foo desc 78 description: foo desc
79 ''', sources); 79 ''', sources);
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 description: foo desc 162 description: foo desc
163 ''', sources); 163 ''', sources);
164 }); 164 });
165 }); 165 });
166 }); 166 });
167 } 167 }
168 168
169 throwsBadFormat(function) { 169 throwsBadFormat(function) {
170 expectThrow(function, (e) => e is FormatException); 170 expectThrow(function, (e) => e is FormatException);
171 } 171 }
OLDNEW
« no previous file with comments | « no previous file | utils/tests/pub/version_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698