OLD | NEW |
1 library java.junit; | 1 library java.junit; |
2 | 2 |
3 import 'package:unittest/unittest.dart' hide fail; | 3 import 'package:unittest/unittest.dart' hide fail; |
4 import 'package:unittest/unittest.dart' as _ut show fail; | 4 import 'package:unittest/unittest.dart' as _ut show fail; |
5 | 5 |
6 | 6 |
7 class JUnitTestCase { | 7 class JUnitTestCase { |
8 void setUp() {} | 8 void setUp() {} |
9 void tearDown() {} | 9 void tearDown() {} |
10 static void fail(String msg) { | 10 static void fail(String msg) { |
(...skipping 16 matching lines...) Expand all Loading... |
27 } | 27 } |
28 static void assertNotNull(x) { | 28 static void assertNotNull(x) { |
29 expect(x, isNotNull); | 29 expect(x, isNotNull); |
30 } | 30 } |
31 static void assertEquals(expected, actual) { | 31 static void assertEquals(expected, actual) { |
32 expect(actual, equals(expected)); | 32 expect(actual, equals(expected)); |
33 } | 33 } |
34 static void assertEqualsMsg(String msg, expected, actual) { | 34 static void assertEqualsMsg(String msg, expected, actual) { |
35 expect(actual, equalsMsg(msg, expected)); | 35 expect(actual, equalsMsg(msg, expected)); |
36 } | 36 } |
| 37 static void assertSame(expected, actual) { |
| 38 expect(actual, same(expected)); |
| 39 } |
37 } | 40 } |
38 | 41 |
39 runJUnitTest(testInstance, Function testFunction) { | 42 runJUnitTest(testInstance, Function testFunction) { |
40 testInstance.setUp(); | 43 testInstance.setUp(); |
41 try { | 44 try { |
42 testFunction(); | 45 testFunction(); |
43 } finally { | 46 } finally { |
44 testInstance.tearDown(); | 47 testInstance.tearDown(); |
45 } | 48 } |
46 } | 49 } |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 return item == false; | 103 return item == false; |
101 } | 104 } |
102 Description describe(Description mismatchDescription) { | 105 Description describe(Description mismatchDescription) { |
103 return mismatchDescription.replace(msg); | 106 return mismatchDescription.replace(msg); |
104 } | 107 } |
105 Description describeMismatch(item, Description mismatchDescription, | 108 Description describeMismatch(item, Description mismatchDescription, |
106 MatchState matchState, bool verbose) { | 109 MatchState matchState, bool verbose) { |
107 return mismatchDescription.replace(msg).add(" $item is not false"); | 110 return mismatchDescription.replace(msg).add(" $item is not false"); |
108 } | 111 } |
109 } | 112 } |
OLD | NEW |