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

Unified Diff: pkg/analyzer/test/generated/test_support.dart

Issue 686793002: Replace EngineTestCase.assertSize() with hasLength(). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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
Index: pkg/analyzer/test/generated/test_support.dart
diff --git a/pkg/analyzer/test/generated/test_support.dart b/pkg/analyzer/test/generated/test_support.dart
index a49b1f4cc6718fd290d260b1df26a4b4c054ec2f..d0534b8a73ef828504ccf243dce1c6765f78a270 100644
--- a/pkg/analyzer/test/generated/test_support.dart
+++ b/pkg/analyzer/test/generated/test_support.dart
@@ -60,7 +60,7 @@ class EngineTestCase {
fail(buffer.toString());
}
}
- assertLength(names.length, elements);
+ expect(elements, hasLength(names.length));
}
AnalysisContextImpl createAnalysisContext() {
@@ -123,22 +123,6 @@ class EngineTestCase {
}
/**
- * Assert that the given collection is non-`null` and has the expected number of elements.
- *
- * @param expectedSize the expected number of elements
- * @param c the collection being tested
- * @throws AssertionFailedError if the list is `null` or does not have the expected number
- * of elements
- */
- static void assertCollectionSize(int expectedSize, Iterable c) {
- if (c == null) {
- fail("Expected collection of size $expectedSize; found null");
- } else if (c.length != expectedSize) {
- fail("Expected collection of size $expectedSize; contained ${c.length} elements");
- }
- }
-
- /**
* Assert that the given array is non-`null` and contains the expected elements. The
* elements can appear in any order.
*
@@ -315,22 +299,6 @@ class EngineTestCase {
}
/**
- * Assert that the given array is non-`null` and has the expected number of elements.
- *
- * @param expectedLength the expected number of elements
- * @param array the array being tested
- * @throws AssertionFailedError if the array is `null` or does not have the expected number
- * of elements
- */
- static void assertLength(int expectedLength, List<Object> array) {
- if (array == null) {
- fail("Expected array of length $expectedLength; found null");
- } else if (array.length != expectedLength) {
- fail("Expected array of length $expectedLength; contained ${array.length} elements");
- }
- }
-
- /**
* Assert that the actual token has the same type and lexeme as the expected token. Note that this
* does not assert anything about the offsets of the tokens (although the lengths will be equal).
*
@@ -349,53 +317,6 @@ class EngineTestCase {
}
}
- /**
- * Assert that the given list is non-`null` and has the expected number of elements.
- *
- * @param expectedSize the expected number of elements
- * @param list the list being tested
- * @throws AssertionFailedError if the list is `null` or does not have the expected number
- * of elements
- */
- static void assertSizeOfList(int expectedSize, List list) {
- if (list == null) {
- fail("Expected list of size $expectedSize; found null");
- } else if (list.length != expectedSize) {
- fail("Expected list of size $expectedSize; contained ${list.length} elements");
- }
- }
-
- /**
- * Assert that the given map is non-`null` and has the expected number of elements.
- *
- * @param expectedSize the expected number of elements
- * @param map the map being tested
- * @throws AssertionFailedError if the map is `null` or does not have the expected number of
- * elements
- */
- static void assertSizeOfMap(int expectedSize, Map map) {
- if (map == null) {
- fail("Expected map of size $expectedSize; found null");
- } else if (map.length != expectedSize) {
- fail("Expected map of size $expectedSize; contained ${map.length} elements");
- }
- }
-
- /**
- * Assert that the given set is non-`null` and has the expected number of elements.
- *
- * @param expectedSize the expected number of elements
- * @param set the set being tested
- * @throws AssertionFailedError if the set is `null` or does not have the expected number of
- * elements
- */
- static void assertSizeOfSet(int expectedSize, Set set) {
- if (set == null) {
- fail("Expected set of size $expectedSize; found null");
- } else if (set.length != expectedSize) {
- fail("Expected set of size $expectedSize; contained ${set.length} elements");
- }
- }
/**
* @return the [AstNode] with requested type at offset of the "prefix".
« no previous file with comments | « pkg/analyzer/test/generated/static_warning_code_test.dart ('k') | pkg/analyzer/test/generated/utilities_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698