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

Side by Side Diff: pkg/analyzer_experimental/lib/src/generated/java_junit.dart

Issue 45573002: Rename analyzer_experimental to analyzer. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Tweaks before publishing. Created 7 years, 1 month 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
(Empty)
1 library java.junit;
2
3 import 'package:unittest/unittest.dart' hide fail;
4 import 'package:unittest/unittest.dart' as _ut show fail;
5
6
7 class JUnitTestCase {
8 void setUp() {}
9 void tearDown() {}
10 static void fail(String msg) {
11 _ut.fail(msg);
12 }
13 static void assertTrue(bool x) {
14 expect(x, isTrue);
15 }
16 static void assertTrueMsg(String msg, bool x) {
17 expect(x, isTrueMsg(msg));
18 }
19 static void assertFalse(bool x) {
20 expect(x, isFalse);
21 }
22 static void assertFalseMsg(String msg, bool x) {
23 expect(x, isFalseMsg(msg));
24 }
25 static void assertNull(x) {
26 expect(x, isNull);
27 }
28 static void assertNotNull(x) {
29 expect(x, isNotNull);
30 }
31 static void assertNotNullMsg(String msg, x) {
32 expect(x, isNotNullMsg(msg));
33 }
34 static void assertEquals(expected, actual) {
35 expect(actual, equals(expected));
36 }
37 static void assertEqualsMsg(String msg, expected, actual) {
38 expect(actual, equalsMsg(msg, expected));
39 }
40 static void assertSame(expected, actual) {
41 expect(actual, same(expected));
42 }
43 static void assertSameMsg(String msg, expected, actual) {
44 expect(actual, sameMsg(msg, expected));
45 }
46 }
47
48 runJUnitTest(testInstance, Function testFunction) {
49 testInstance.setUp();
50 try {
51 testFunction();
52 } finally {
53 testInstance.tearDown();
54 }
55 }
56
57 /**
58 * Returns a matches that matches if the value is not the same instance as "obje ct" (`!==`).
59 */
60 Matcher notSame(expected) => new _IsNotSameAs(expected);
61
62 class _IsNotSameAs extends Matcher {
63 final _expected;
64 const _IsNotSameAs(this._expected);
65 bool matches(item, Map matchState) => !identical(item, _expected);
66 Description describe(Description description) =>
67 description.add('not same instance as ').addDescriptionOf(_expected);
68 }
69
70 Matcher equalsMsg(String msg, expected) => new _EqualsWithMessage(msg, expected) ;
71 class _EqualsWithMessage extends Matcher {
72 final String msg;
73 final expectedValue;
74 const _EqualsWithMessage(this.msg, this.expectedValue);
75 bool matches(item, Map matchState) {
76 return item == expectedValue;
77 }
78 Description describe(Description mismatchDescription) {
79 return mismatchDescription.replace(msg);
80 }
81 }
82
83 Matcher sameMsg(String msg, expected) => new _IsSameAsWithMessage(msg, expected) ;
84 class _IsSameAsWithMessage extends Matcher {
85 final String msg;
86 final _expected;
87 const _IsSameAsWithMessage(this.msg, this._expected);
88 bool matches(item, Map matchState) => identical(item, _expected);
89 Description describe(Description description) => description.add(msg).addDescr iptionOf(_expected);
90 }
91
92 Matcher isTrueMsg(String msg) => new _IsTrueWithMessage(msg);
93 class _IsTrueWithMessage extends Matcher {
94 final String msg;
95 const _IsTrueWithMessage(this.msg);
96 bool matches(item, Map matchState) {
97 return item == true;
98 }
99 Description describe(Description mismatchDescription) {
100 return mismatchDescription.replace(msg);
101 }
102 }
103
104 Matcher isFalseMsg(String msg) => new _IsFalseWithMessage(msg);
105 class _IsFalseWithMessage extends Matcher {
106 final String msg;
107 const _IsFalseWithMessage(this.msg);
108 bool matches(item, Map matchState) {
109 return item == false;
110 }
111 Description describe(Description mismatchDescription) {
112 return mismatchDescription.replace(msg);
113 }
114 }
115
116 Matcher isNotNullMsg(String msg) => new _IsNotNullWithMessage(msg);
117 class _IsNotNullWithMessage extends Matcher {
118 final String msg;
119 const _IsNotNullWithMessage(this.msg);
120 bool matches(item, Map matchState) {
121 return item != null;
122 }
123 Description describe(Description mismatchDescription) {
124 return mismatchDescription.replace(msg);
125 }
126 }
OLDNEW
« no previous file with comments | « pkg/analyzer_experimental/lib/src/generated/java_io.dart ('k') | pkg/analyzer_experimental/lib/src/generated/parser.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698