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

Unified Diff: client/tests/client/util/util_tests.dart

Issue 8337002: Clean up util tests to use new style. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Force it to be a web test. Created 9 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/tests/client/util/util_tests.dart
diff --git a/client/tests/client/util/util_tests.dart b/client/tests/client/util/util_tests.dart
index 30a0034da5113c0a0a8a6426bb18a9a2832fb40f..562abf0e42cc9ee247f69020d28134c6ed78de15 100644
--- a/client/tests/client/util/util_tests.dart
+++ b/client/tests/client/util/util_tests.dart
@@ -4,49 +4,41 @@
#library('util_tests');
-#import('dart:html');
+#import('dart:html'); // TODO(rnystrom): Only needed to tell architecture.py
+ // that this is a web test. Come up with cleaner solution.
#import('../../../testing/unittest/unittest.dart');
#import('../../../util/utilslib.dart');
main() {
- new UtilsTests().run();
-}
-
-class UtilsTests extends UnitTestSuite {
-
- UtilsTests() : super() {}
-
- void setUpTestSuite() {
- addTest(void testInsertAt() {
- List a = new List();
- CollectionUtils.insertAt(a, 0, 1);
- Expect.listEquals([1], a);
-
- CollectionUtils.insertAt(a, 0, 2);
- Expect.listEquals([2, 1], a);
-
- CollectionUtils.insertAt(a, 0, 5);
- CollectionUtils.insertAt(a, 0, 4);
- CollectionUtils.insertAt(a, 0, 3);
- Expect.listEquals([3, 4, 5, 2, 1], a);
-
- a = new List();
- CollectionUtils.insertAt(a, 0, 1);
- Expect.listEquals([1], a);
-
- CollectionUtils.insertAt(a, 1, 2);
- Expect.listEquals([1, 2], a);
-
- CollectionUtils.insertAt(a, 1, 3);
- CollectionUtils.insertAt(a, 3, 4);
- CollectionUtils.insertAt(a, 3, 5);
- Expect.listEquals([1, 3, 2, 5, 4], a);
- });
-
- addTest(void testDefaultString() {
- Expect.equals('', StringUtils.defaultString(null));
- Expect.equals('', StringUtils.defaultString(''));
- Expect.equals('test', StringUtils.defaultString('test'));
- });
- }
+ test('insertAt', () {
+ var a = [];
+ CollectionUtils.insertAt(a, 0, 1);
+ expect(a).equalsCollection([1]);
+
+ CollectionUtils.insertAt(a, 0, 2);
+ expect(a).equalsCollection([2, 1]);
+
+ CollectionUtils.insertAt(a, 0, 5);
+ CollectionUtils.insertAt(a, 0, 4);
+ CollectionUtils.insertAt(a, 0, 3);
+ expect(a).equalsCollection([3, 4, 5, 2, 1]);
+
+ a = [];
+ CollectionUtils.insertAt(a, 0, 1);
+ expect(a).equalsCollection([1]);
+
+ CollectionUtils.insertAt(a, 1, 2);
+ expect(a).equalsCollection([1, 2]);
+
+ CollectionUtils.insertAt(a, 1, 3);
+ CollectionUtils.insertAt(a, 3, 4);
+ CollectionUtils.insertAt(a, 3, 5);
+ expect(a).equalsCollection([1, 3, 2, 5, 4]);
+ });
+
+ test('defaultString', () {
+ expect(StringUtils.defaultString(null)).equals('');
+ expect(StringUtils.defaultString('')).equals('');
+ expect(StringUtils.defaultString('test')).equals('test');
+ });
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698