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

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

Issue 199793010: pkg/matcher: test cleanup (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: fixed skipped test Created 6 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 | Annotate | Revision Log
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;
blois 2014/03/24 22:55:21 mirror_test?
kevmoo 2014/03/25 00:12:46 Done.
6
5 import 'package:matcher/mirror_matchers.dart'; 7 import 'package:matcher/mirror_matchers.dart';
6 import 'package:unittest/unittest.dart' as ut; 8 import 'package:unittest/unittest.dart' show test;
7 9
8 import 'test_utils.dart'; 10 import 'test_utils.dart';
9 11
10 class C { 12 class C {
11 var instanceField = 1; 13 var instanceField = 1;
12 get instanceGetter => 2; 14 get instanceGetter => 2;
13 static var staticField = 3; 15 static var staticField = 3;
14 static get staticGetter => 4; 16 static get staticGetter => 4;
15 } 17 }
16 18
17 void main() { 19 void main() {
18 20
19 initUtils(); 21 initUtils();
20 22
21 ut.test('hasProperty', () { 23 test('hasProperty', () {
22 var foo = [3]; 24 var foo = [3];
23 shouldPass(foo, hasProperty('length', 1)); 25 shouldPass(foo, hasProperty('length', 1));
24 shouldFail(foo, hasProperty('foo'), 'Expected: has property "foo" ' 26 shouldFail(foo, hasProperty('foo'), 'Expected: has property "foo" '
25 'Actual: [3] ' 27 'Actual: [3] '
26 'Which: has no property named "foo"'); 28 'Which: has no property named "foo"');
27 shouldFail(foo, hasProperty('length', 2), 29 shouldFail(foo, hasProperty('length', 2),
28 'Expected: has property "length" which matches <2> ' 30 'Expected: has property "length" which matches <2> '
29 'Actual: [3] ' 31 'Actual: [3] '
30 'Which: has property "length" with value <1>'); 32 'Which: has property "length" with value <1>');
31 var c = new C(); 33 var c = new C();
32 shouldPass(c, hasProperty('instanceField', 1)); 34 shouldPass(c, hasProperty('instanceField', 1));
33 shouldPass(c, hasProperty('instanceGetter', 2)); 35 shouldPass(c, hasProperty('instanceGetter', 2));
34 shouldFail(c, hasProperty('staticField'), 36 shouldFail(c, hasProperty('staticField'),
35 'Expected: has property "staticField" ' 37 'Expected: has property "staticField" '
36 'Actual: <Instance of \'C\'> ' 38 'Actual: <Instance of \'C\'> '
37 'Which: has a member named "staticField",' 39 'Which: has a member named "staticField",'
38 ' but it is not an instance property'); 40 ' but it is not an instance property');
39 shouldFail(c, hasProperty('staticGetter'), 41 shouldFail(c, hasProperty('staticGetter'),
40 'Expected: has property "staticGetter" ' 42 'Expected: has property "staticGetter" '
41 'Actual: <Instance of \'C\'> ' 43 'Actual: <Instance of \'C\'> '
42 'Which: has a member named "staticGetter",' 44 'Which: has a member named "staticGetter",'
43 ' but it is not an instance property'); 45 ' but it is not an instance property');
44 }); 46 });
45 } 47 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698