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

Side by Side Diff: pkg/typed_mock/test/typed_mock_test.dart

Issue 2743423009: Run dartfmt on remaining unformated pkg packages (Closed)
Patch Set: Run dartfmt on remaining unformated pkg packages Created 3 years, 9 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
« no previous file with comments | « pkg/typed_mock/lib/typed_mock.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 library test.typed_mock; 1 library test.typed_mock;
2 2
3 import 'package:unittest/unittest.dart'; 3 import 'package:unittest/unittest.dart';
4 4
5 import 'package:typed_mock/typed_mock.dart'; 5 import 'package:typed_mock/typed_mock.dart';
6 6
7
8 abstract class TestInterface { 7 abstract class TestInterface {
9 int get testProperty; 8 int get testProperty;
10 set testProperty(x); 9 set testProperty(x);
11 int get testPropertyB; 10 int get testPropertyB;
12 String testMethod0(); 11 String testMethod0();
13 String testMethod1(a); 12 String testMethod1(a);
14 String testMethod2(String a, int b); 13 String testMethod2(String a, int b);
15 void testMethodVoid(a); 14 void testMethodVoid(a);
16 int operator [](index); 15 int operator [](index);
17 } 16 }
18 17
19
20 class TestInterfaceMock extends TypedMock implements TestInterface { 18 class TestInterfaceMock extends TypedMock implements TestInterface {
21 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); 19 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
22 } 20 }
23 21
24
25 main() { 22 main() {
26 // lets make it redable 23 // lets make it redable
27 groupSep = ' | '; 24 groupSep = ' | ';
28 25
29 group('VerifyError', () { 26 group('VerifyError', () {
30 test('VerifyError', () { 27 test('VerifyError', () {
31 var error = new VerifyError('msg'); 28 var error = new VerifyError('msg');
32 expect(error.message, 'msg'); 29 expect(error.message, 'msg');
33 expect(error.toString(), 'VerifyError: msg'); 30 expect(error.toString(), 'VerifyError: msg');
34 }); 31 });
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 verify(obj.testMethod1(anyBool)).times(0); 221 verify(obj.testMethod1(anyBool)).times(0);
225 }); 222 });
226 223
227 test('OK, getter, with thenReturn', () { 224 test('OK, getter, with thenReturn', () {
228 when(obj.testProperty).thenReturn('abc'); 225 when(obj.testProperty).thenReturn('abc');
229 obj.testProperty; 226 obj.testProperty;
230 obj.testProperty; 227 obj.testProperty;
231 verify(obj.testProperty).times(2); 228 verify(obj.testProperty).times(2);
232 }); 229 });
233 230
234 test('OK, void method', () { 231 test('OK, void method', () {
235 obj.testMethodVoid(10); 232 obj.testMethodVoid(10);
236 obj.testMethodVoid(20); 233 obj.testMethodVoid(20);
237 verify(obj.testMethodVoid(anyInt)).times(2); 234 verify(obj.testMethodVoid(anyInt)).times(2);
238 }); 235 });
239 236
240 test('mismatch, getter', () { 237 test('mismatch, getter', () {
241 obj.testProperty; 238 obj.testProperty;
242 obj.testProperty; 239 obj.testProperty;
243 obj.testProperty; 240 obj.testProperty;
244 expect(() { 241 expect(() {
245 verify(obj.testProperty).times(2); 242 verify(obj.testProperty).times(2);
246 }, throwsA(_isVerifyError)); 243 }, throwsA(_isVerifyError));
247 }); 244 });
248 }); 245 });
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 verify(obj.testMethod1(anyInt)).any(); 382 verify(obj.testMethod1(anyInt)).any();
386 expect(() { 383 expect(() {
387 verifyZeroInteractions(obj); 384 verifyZeroInteractions(obj);
388 }, throwsA(_isVerifyError)); 385 }, throwsA(_isVerifyError));
389 }); 386 });
390 }); 387 });
391 }); 388 });
392 } 389 }
393 390
394 const _isVerifyError = const isInstanceOf<VerifyError>(); 391 const _isVerifyError = const isInstanceOf<VerifyError>();
OLDNEW
« no previous file with comments | « pkg/typed_mock/lib/typed_mock.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698