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

Side by Side Diff: test/mirror_matchers_test.dart

Issue 867133002: pkg/matcher: refactor with unittest v0.12 work (Closed) Base URL: https://github.com/dart-lang/matcher.git@master
Patch Set: cl nits Created 5 years, 10 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 | « test/matchers_unminified_test.dart ('k') | test/numeric_matchers_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 matcher.mirror_test; 5 library matcher.mirror_test;
6 6
7 import 'package:matcher/mirror_matchers.dart'; 7 import 'package:matcher/mirror_matchers.dart';
8 import 'package:unittest/unittest.dart' show test; 8 import 'package:unittest/unittest.dart' show test;
9 9
10 import 'test_utils.dart'; 10 import 'test_utils.dart';
11 11
12 class C { 12 class C {
13 var instanceField = 1; 13 var instanceField = 1;
14 get instanceGetter => 2; 14 get instanceGetter => 2;
15 static var staticField = 3; 15 static var staticField = 3;
16 static get staticGetter => 4; 16 static get staticGetter => 4;
17 } 17 }
18 18
19 void main() { 19 void main() {
20 initUtils();
21
22 test('hasProperty', () { 20 test('hasProperty', () {
23 var foo = [3]; 21 var foo = [3];
24 shouldPass(foo, hasProperty('length', 1)); 22 shouldPass(foo, hasProperty('length', 1));
25 shouldFail(foo, hasProperty('foo'), 'Expected: has property "foo" ' 23 shouldFail(foo, hasProperty('foo'), 'Expected: has property "foo" '
26 'Actual: [3] ' 24 'Actual: [3] '
27 'Which: has no property named "foo"'); 25 'Which: has no property named "foo"');
28 shouldFail(foo, hasProperty('length', 2), 26 shouldFail(foo, hasProperty('length', 2),
29 'Expected: has property "length" which matches <2> ' 27 'Expected: has property "length" which matches <2> '
30 'Actual: [3] ' 28 'Actual: [3] '
31 'Which: has property "length" with value <1>'); 29 'Which: has property "length" with value <1>');
32 var c = new C(); 30 var c = new C();
33 shouldPass(c, hasProperty('instanceField', 1)); 31 shouldPass(c, hasProperty('instanceField', 1));
34 shouldPass(c, hasProperty('instanceGetter', 2)); 32 shouldPass(c, hasProperty('instanceGetter', 2));
35 shouldFail(c, hasProperty('staticField'), 33 shouldFail(c, hasProperty('staticField'),
36 'Expected: has property "staticField" ' 34 'Expected: has property "staticField" '
37 'Actual: <Instance of \'C\'> ' 35 'Actual: <Instance of \'C\'> '
38 'Which: has a member named "staticField",' 36 'Which: has a member named "staticField",'
39 ' but it is not an instance property'); 37 ' but it is not an instance property');
40 shouldFail(c, hasProperty('staticGetter'), 38 shouldFail(c, hasProperty('staticGetter'),
41 'Expected: has property "staticGetter" ' 39 'Expected: has property "staticGetter" '
42 'Actual: <Instance of \'C\'> ' 40 'Actual: <Instance of \'C\'> '
43 'Which: has a member named "staticGetter",' 41 'Which: has a member named "staticGetter",'
44 ' but it is not an instance property'); 42 ' but it is not an instance property');
45 }); 43 });
46 } 44 }
OLDNEW
« no previous file with comments | « test/matchers_unminified_test.dart ('k') | test/numeric_matchers_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698