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

Side by Side Diff: packages/matcher/test/mirror_matchers_test.dart

Issue 2989763002: Update charted to 0.4.8 and roll (Closed)
Patch Set: Removed Cutch from list of reviewers Created 3 years, 4 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
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;
6
7 import 'package:matcher/mirror_matchers.dart'; 5 import 'package:matcher/mirror_matchers.dart';
8 import 'package:test/test.dart' show test; 6 import 'package:test/test.dart';
9 7
10 import 'test_utils.dart'; 8 import 'test_utils.dart';
11 9
12 class C { 10 class C {
13 var instanceField = 1; 11 var instanceField = 1;
14 get instanceGetter => 2; 12 get instanceGetter => 2;
15 static var staticField = 3; 13 static var staticField = 3;
16 static get staticGetter => 4; 14 static get staticGetter => 4;
17 } 15 }
18 16
19 void main() { 17 void main() {
20 test('hasProperty', () { 18 test('hasProperty', () {
21 var foo = [3]; 19 var foo = [3];
22 shouldPass(foo, hasProperty('length', 1)); 20 shouldPass(foo, hasProperty('length', 1));
23 shouldFail(foo, hasProperty('foo'), 'Expected: has property "foo" ' 21 shouldFail(
22 foo,
23 hasProperty('foo'),
24 'Expected: has property "foo" '
24 'Actual: [3] ' 25 'Actual: [3] '
25 'Which: has no property named "foo"'); 26 'Which: has no property named "foo"');
26 shouldFail(foo, hasProperty('length', 2), 27 shouldFail(
28 foo,
29 hasProperty('length', 2),
27 'Expected: has property "length" which matches <2> ' 30 'Expected: has property "length" which matches <2> '
28 'Actual: [3] ' 31 'Actual: [3] '
29 'Which: has property "length" with value <1>'); 32 'Which: has property "length" with value <1>');
30 var c = new C(); 33 var c = new C();
31 shouldPass(c, hasProperty('instanceField', 1)); 34 shouldPass(c, hasProperty('instanceField', 1));
32 shouldPass(c, hasProperty('instanceGetter', 2)); 35 shouldPass(c, hasProperty('instanceGetter', 2));
33 shouldFail(c, hasProperty('staticField'), 36 shouldFail(
37 c,
38 hasProperty('staticField'),
34 'Expected: has property "staticField" ' 39 'Expected: has property "staticField" '
35 'Actual: <Instance of \'C\'> ' 40 'Actual: <Instance of \'C\'> '
36 'Which: has a member named "staticField",' 41 'Which: has a member named "staticField",'
37 ' but it is not an instance property'); 42 ' but it is not an instance property');
38 shouldFail(c, hasProperty('staticGetter'), 43 shouldFail(
44 c,
45 hasProperty('staticGetter'),
39 'Expected: has property "staticGetter" ' 46 'Expected: has property "staticGetter" '
40 'Actual: <Instance of \'C\'> ' 47 'Actual: <Instance of \'C\'> '
41 'Which: has a member named "staticGetter",' 48 'Which: has a member named "staticGetter",'
42 ' but it is not an instance property'); 49 ' but it is not an instance property');
43 }); 50 });
44 } 51 }
OLDNEW
« no previous file with comments | « packages/matcher/test/iterable_matchers_test.dart ('k') | packages/matcher/test/numeric_matchers_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698