@@ -26,6 +26,12 @@ protected void doTest(@NotNull final String before, @NotNull final String after,
2626 myFixture .checkResult (after );
2727 }
2828
29+ /**
30+ * Note: These tests were recently updated to match the expected output, but should the code formatter used by the
31+ * Dart Analysis server change, these tests will start to break again. They are updated to match with the assumption
32+ * that the equals and hashcode tests include testing features of Intellij and the Dart plugin, not just the
33+ * formatting returned from the server.
34+ */
2935 public void testEqualsAndHashcodeNoSuper () {
3036 doEqualsAndHashcodeTest ("""
3137 class Interface {
@@ -38,22 +44,22 @@ class Foo extends Bar with Baz implements Interface {<caret>}
3844 """ ,
3945
4046 """
41- class Interface {
42- bool operator ==(Object other) => super == other;
43- int get hashCode => super.hashCode;
44- }
45- class Bar {}
46- class Baz implements Interface {}
47- class Foo extends Bar with Baz implements Interface {
48- @override
49- bool operator ==(Object other) =>
50- identical(this, other) ||
51- other is Foo && runtimeType == other.runtimeType;
52-
53- @override
54- int get hashCode => 0;
55- }
56- """ );
47+ class Interface {
48+ bool operator ==(Object other) => super == other;
49+ int get hashCode => super.hashCode;
50+ }
51+ class Bar {}
52+ class Baz implements Interface {}
53+ class Foo extends Bar with Baz implements Interface {
54+ @override
55+ bool operator ==(Object other) =>
56+ identical(this, other) ||
57+ other is Foo && runtimeType == other.runtimeType;
58+
59+ @override
60+ int get hashCode => 0;
61+ }
62+ """ );
5763 }
5864
5965 public void testEqualsAndHashcodeWithSuper () {
@@ -66,20 +72,20 @@ class Baz {
6672 class Foo extends Bar {<caret>}""" ,
6773
6874 """
69- class Bar extends Baz {}
70- class Baz {
71- bool operator ==(Object other) => super == other;
72- int get hashCode => super.hashCode;
73- }
74- class Foo extends Bar {
75- @override
76- bool operator ==(Object other) =>
77- identical(this, other) ||
78- other is Foo && runtimeType == other.runtimeType;
79-
80- @override
81- int get hashCode => 0;
82- }""" );
75+ class Bar extends Baz {}
76+ class Baz {
77+ bool operator ==(Object other) => super == other;
78+ int get hashCode => super.hashCode;
79+ }
80+ class Foo extends Bar {
81+ @override
82+ bool operator ==(Object other) =>
83+ identical(this, other) ||
84+ other is Foo && runtimeType == other.runtimeType;
85+
86+ @override
87+ int get hashCode => 0;
88+ }""" );
8389 }
8490
8591 public void testEqualsAndHashcodeWithFieldsNoSuper () {
@@ -105,12 +111,13 @@ class Foo extends Object implements Interface {
105111 @override
106112 bool operator ==(Object other) =>
107113 identical(this, other) ||
108- other is Foo && runtimeType == other.runtimeType && e == other.e &&
109- b == other.b;
114+ other is Foo &&
115+ runtimeType == other.runtimeType &&
116+ e == other.e &&
117+ b == other.b;
110118
111119 @override
112120 int get hashCode => Object.hash(e, b);
113-
114121 }""" );
115122 }
116123
@@ -139,12 +146,13 @@ class Foo extends Bar {
139146 @override
140147 bool operator ==(Object other) =>
141148 identical(this, other) ||
142- other is Foo && runtimeType == other.runtimeType && e == other.e &&
143- b == other.b;
149+ other is Foo &&
150+ runtimeType == other.runtimeType &&
151+ e == other.e &&
152+ b == other.b;
144153
145154 @override
146155 int get hashCode => Object.hash(e, b);
147-
148156 }""" );
149157 }
150158}
0 commit comments