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: third_party/pkg/di/test/fixed-unittest.dart

Issue 176943008: Update the Angular/DI tests to latest from github. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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 library unittest; 1 library unittest;
2 2
3 import 'package:unittest/unittest.dart'; 3 import 'package:unittest/unittest.dart';
4 import 'package:di/mirrors.dart'; 4 import 'package:di/mirrors.dart';
5 import 'dart:async'; 5 import 'dart:async';
6 6
7 export 'package:unittest/unittest.dart'; 7 export 'package:unittest/unittest.dart';
8 8
9 // Jasmine-like syntax for unittest. 9 // Jasmine-like syntax for unittest.
10 void describe(String spec, TestFunction body) => group(spec, body); 10 void describe(String spec, TestFunction body) => group(spec, body);
11 void ddescribe(String spec, TestFunction body) => solo_group(spec, body); 11 void ddescribe(String spec, TestFunction body) => solo_group(spec, body);
12 void xdescribe(String spec, TestFunction body) {} 12 void xdescribe(String spec, TestFunction body) {}
13 void it(String spec, TestFunction body) => test(spec, body); 13 void it(String spec, TestFunction body) => test(spec, body);
14 void xit(String spec, TestFunction body) {} 14 void xit(String spec, TestFunction body) {}
15 void iit(String spec, TestFunction body) => solo_test(spec, body); 15 void iit(String spec, TestFunction body) => solo_test(spec, body);
16 16
17 Matcher toEqual(expected) => equals(expected); 17 Matcher toEqual(expected) => equals(expected);
18 Matcher toContain(expected) => contains(expected); 18 Matcher toContain(expected) => contains(expected);
19 Matcher toBe(expected) => same(expected); 19 Matcher toBe(expected) => same(expected);
20 Matcher instanceOf(Type t) => new IsInstanceOfTypeMatcher(t); 20 Matcher instanceOf(Type t) => new IsInstanceOfTypeMatcher(t);
21 21
22 Matcher toThrow(Type exceptionClass, String message) => 22 Matcher toThrow(Type exceptionClass, [message]) => message == null
23 new ThrowsMatcher(new ComplexExceptionMatcher( 23 ? new ThrowsMatcher(instanceOf(exceptionClass))
24 instanceOf(exceptionClass), toContain(message))); 24 : new ThrowsMatcher(new ComplexExceptionMatcher(
25 instanceOf(exceptionClass),
26 message is Matcher ? message : toContain(message)));
25 27
26 Matcher not(Matcher matcher) => new NegateMatcher(matcher); 28 Matcher not(Matcher matcher) => new NegateMatcher(matcher);
27 29
28 30
29 class NegateMatcher extends Matcher { 31 class NegateMatcher extends Matcher {
30 final Matcher _matcher; 32 final Matcher _matcher;
31 33
32 const NegateMatcher(this._matcher); 34 const NegateMatcher(this._matcher);
33 35
34 bool matches(obj, Map ms) => !_matcher.matches(obj, ms); 36 bool matches(obj, Map ms) => !_matcher.matches(obj, ms);
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 Type t; 101 Type t;
100 102
101 IsInstanceOfTypeMatcher(this.t); 103 IsInstanceOfTypeMatcher(this.t);
102 104
103 bool matches(obj, Map matchState) => 105 bool matches(obj, Map matchState) =>
104 reflect(obj).type.qualifiedName == reflectClass(t).qualifiedName; 106 reflect(obj).type.qualifiedName == reflectClass(t).qualifiedName;
105 107
106 Description describe(Description description) => 108 Description describe(Description description) =>
107 description.add('an instance of ${t.toString()}'); 109 description.add('an instance of ${t.toString()}');
108 } 110 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698