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

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

Issue 311893002: Tweaks for typed_mock. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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
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' hide equals; 5 import 'package:typed_mock/typed_mock.dart';
6 import 'package:typed_mock/typed_mock.dart' as typed_mocks show equals;
7 6
8 7
9 abstract class TestInterface { 8 abstract class TestInterface {
10 int get testProperty; 9 int get testProperty;
11 set testProperty(x); 10 set testProperty(x);
12 int get testPropertyB; 11 int get testPropertyB;
13 String testMethod0(); 12 String testMethod0();
14 String testMethod1(a); 13 String testMethod1(a);
15 String testMethod2(String a, int b); 14 String testMethod2(String a, int b);
16 void testMethodVoid(a); 15 void testMethodVoid(a);
(...skipping 12 matching lines...) Expand all
29 28
30 group('VerifyError', () { 29 group('VerifyError', () {
31 test('VerifyError', () { 30 test('VerifyError', () {
32 var error = new VerifyError('msg'); 31 var error = new VerifyError('msg');
33 expect(error.message, 'msg'); 32 expect(error.message, 'msg');
34 expect(error.toString(), 'VerifyError: msg'); 33 expect(error.toString(), 'VerifyError: msg');
35 }); 34 });
36 }); 35 });
37 36
38 group('Matchers', () { 37 group('Matchers', () {
39 test('equals', () {
40 expect(typed_mocks.equals(10).matches(10), true);
41 expect(typed_mocks.equals(10).matches(20), false);
42 expect(typed_mocks.equals('abc').matches('abc'), true);
43 expect(typed_mocks.equals('abc').matches('xyz'), false);
44 });
45
46 test('anyBool', () { 38 test('anyBool', () {
47 expect(anyBool.matches(true), true); 39 expect(anyBool.matches(true), true);
48 expect(anyBool.matches(false), true); 40 expect(anyBool.matches(false), true);
49 expect(anyBool.matches(0), false); 41 expect(anyBool.matches(0), false);
50 expect(anyBool.matches('0'), false); 42 expect(anyBool.matches('0'), false);
51 }); 43 });
52 44
53 test('anyInt', () { 45 test('anyInt', () {
54 expect(anyInt.matches(true), false); 46 expect(anyInt.matches(true), false);
55 expect(anyInt.matches(-99), true); 47 expect(anyInt.matches(-99), true);
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 verify(obj.testMethod1(anyInt)).any(); 377 verify(obj.testMethod1(anyInt)).any();
386 expect(() { 378 expect(() {
387 verifyZeroInteractions(obj); 379 verifyZeroInteractions(obj);
388 }, throwsA(_isVerifyError)); 380 }, throwsA(_isVerifyError));
389 }); 381 });
390 }); 382 });
391 }); 383 });
392 } 384 }
393 385
394 const _isVerifyError = const isInstanceOf<VerifyError>(); 386 const _isVerifyError = const isInstanceOf<VerifyError>();
OLDNEW
« pkg/typed_mock/lib/typed_mock.dart ('K') | « pkg/typed_mock/pubspec.yaml ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698