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

Side by Side Diff: pkg/analyzer-experimental/lib/src/generated/java_junit.dart

Issue 12838003: Rename analyzer-experimental to analyzer_experimental. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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
(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 assertEquals(expected, actual) {
32 expect(actual, equals(expected));
33 }
34 static void assertEqualsMsg(String msg, expected, actual) {
35 expect(actual, equalsMsg(msg, expected));
36 }
37 static void assertSame(expected, actual) {
38 expect(actual, same(expected));
39 }
40 }
41
42 runJUnitTest(testInstance, Function testFunction) {
43 testInstance.setUp();
44 try {
45 testFunction();
46 } finally {
47 testInstance.tearDown();
48 }
49 }
50
51 /**
52 * Returns a matches that matches if the value is not the same instance
53 * as [object] (`!==`).
54 */
55 Matcher notSame(expected) => new _IsNotSameAs(expected);
56
57 class _IsNotSameAs extends BaseMatcher {
58 final _expected;
59 const _IsNotSameAs(this._expected);
60 bool matches(item, MatchState matchState) => !identical(item, _expected);
61 Description describe(Description description) =>
62 description.add('not same instance as ').addDescriptionOf(_expected);
63 }
64
65 Matcher equalsMsg(String msg, expected) => new _EqualsWithMessage(msg, expected) ;
66 class _EqualsWithMessage extends BaseMatcher {
67 final String msg;
68 final expectedValue;
69 const _EqualsWithMessage(this.msg, this.expectedValue);
70 bool matches(item, MatchState matchState) {
71 return item == expectedValue;
72 }
73 Description describe(Description mismatchDescription) {
74 return mismatchDescription.replace(msg);
75 }
76 Description describeMismatch(item, Description mismatchDescription,
77 MatchState matchState, bool verbose) {
78 return mismatchDescription.replace(msg).add(" $item != $expectedValue");
79 }
80 }
81
82 Matcher isTrueMsg(String msg) => new _IsTrueWithMessage(msg);
83 class _IsTrueWithMessage extends BaseMatcher {
84 final String msg;
85 const _IsTrueWithMessage(this.msg);
86 bool matches(item, MatchState matchState) {
87 return item == true;
88 }
89 Description describe(Description mismatchDescription) {
90 return mismatchDescription.replace(msg);
91 }
92 Description describeMismatch(item, Description mismatchDescription,
93 MatchState matchState, bool verbose) {
94 return mismatchDescription.replace(msg).add(" $item is not true");
95 }
96 }
97
98 Matcher isFalseMsg(String msg) => new _IsFalseWithMessage(msg);
99 class _IsFalseWithMessage extends BaseMatcher {
100 final String msg;
101 const _IsFalseWithMessage(this.msg);
102 bool matches(item, MatchState matchState) {
103 return item == false;
104 }
105 Description describe(Description mismatchDescription) {
106 return mismatchDescription.replace(msg);
107 }
108 Description describeMismatch(item, Description mismatchDescription,
109 MatchState matchState, bool verbose) {
110 return mismatchDescription.replace(msg).add(" $item is not false");
111 }
112 }
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