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

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

Issue 736603005: Rollback r41807. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer/lib/src/generated/engine.dart ('k') | pkg/analyzer/test/generated/engine_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/generated/element_test.dart
diff --git a/pkg/analyzer/test/generated/element_test.dart b/pkg/analyzer/test/generated/element_test.dart
index 099f153518c2591700e16719ba39e29ad9757804..2d8d933c3a40b49fa1852a70608d822e385df812 100644
--- a/pkg/analyzer/test/generated/element_test.dart
+++ b/pkg/analyzer/test/generated/element_test.dart
@@ -33,6 +33,7 @@ main() {
runReflectiveTests(VoidTypeImplTest);
runReflectiveTests(ClassElementImplTest);
runReflectiveTests(CompilationUnitElementImplTest);
+ runReflectiveTests(ElementLocationImplTest);
runReflectiveTests(ElementImplTest);
runReflectiveTests(HtmlElementImplTest);
runReflectiveTests(LibraryElementImplTest);
@@ -1057,6 +1058,70 @@ class ElementKindTest extends EngineTestCase {
}
}
+class ElementLocationImplTest extends EngineTestCase {
+ void test_create_encoding() {
+ String encoding = "a;b;c";
+ ElementLocationImpl location = new ElementLocationImpl.con2(encoding);
+ expect(location.encoding, encoding);
+ }
+
+ /**
+ * For example unnamed constructor.
+ */
+ void test_create_encoding_emptyLast() {
+ String encoding = "a;b;c;";
+ ElementLocationImpl location = new ElementLocationImpl.con2(encoding);
+ expect(location.encoding, encoding);
+ }
+
+ void test_equals_equal() {
+ String encoding = "a;b;c";
+ ElementLocationImpl first = new ElementLocationImpl.con2(encoding);
+ ElementLocationImpl second = new ElementLocationImpl.con2(encoding);
+ expect(first == second, isTrue);
+ }
+
+ void test_equals_notEqual_differentLengths() {
+ ElementLocationImpl first = new ElementLocationImpl.con2("a;b;c");
+ ElementLocationImpl second = new ElementLocationImpl.con2("a;b;c;d");
+ expect(first == second, isFalse);
+ }
+
+ void test_equals_notEqual_notLocation() {
+ ElementLocationImpl first = new ElementLocationImpl.con2("a;b;c");
+ expect(first == "a;b;d", isFalse);
+ }
+
+ void test_equals_notEqual_sameLengths() {
+ ElementLocationImpl first = new ElementLocationImpl.con2("a;b;c");
+ ElementLocationImpl second = new ElementLocationImpl.con2("a;b;d");
+ expect(first == second, isFalse);
+ }
+
+ void test_getComponents() {
+ String encoding = "a;b;c";
+ ElementLocationImpl location = new ElementLocationImpl.con2(encoding);
+ List<String> components = location.components;
+ expect(components, hasLength(3));
+ expect(components[0], "a");
+ expect(components[1], "b");
+ expect(components[2], "c");
+ }
+
+ void test_getEncoding() {
+ String encoding = "a;b;c;;d";
+ ElementLocationImpl location = new ElementLocationImpl.con2(encoding);
+ expect(location.encoding, encoding);
+ }
+
+ void test_hashCode_equal() {
+ String encoding = "a;b;c";
+ ElementLocationImpl first = new ElementLocationImpl.con2(encoding);
+ ElementLocationImpl second = new ElementLocationImpl.con2(encoding);
+ expect(first.hashCode == second.hashCode, isTrue);
+ }
+}
+
class FunctionTypeImplTest extends EngineTestCase {
void test_creation() {
expect(
« no previous file with comments | « pkg/analyzer/lib/src/generated/engine.dart ('k') | pkg/analyzer/test/generated/engine_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698