[analyzer] Add Sink and Socket to mock_sdk
This is necessary in order to write unit tests for the `close_sinks`
linter rule.
Change-Id: I1d7d122bf76b87be92f45970fb338d861afd52e1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279327
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
diff --git a/pkg/analyzer/lib/src/test_utilities/mock_sdk.dart b/pkg/analyzer/lib/src/test_utilities/mock_sdk.dart
index edbed2e..884f799 100644
--- a/pkg/analyzer/lib/src/test_utilities/mock_sdk.dart
+++ b/pkg/analyzer/lib/src/test_utilities/mock_sdk.dart
@@ -363,6 +363,17 @@
int compareTo(Duration other) => 0;
}
+abstract class Enum {
+ int get index; // Enum
+ String get _name;
+}
+
+abstract class _Enum implements Enum {
+ final int index;
+ final String _name;
+ const _Enum(this.index, this._name);
+}
+
class Error {
Error();
static String safeToString(Object? object) => '';
@@ -567,17 +578,6 @@
static int hashAllUnordered(Iterable<Object?> objects) => 0;
}
-abstract class Enum {
- int get index; // Enum
- String get _name;
-}
-
-abstract class _Enum implements Enum {
- final int index;
- final String _name;
- const _Enum(this.index, this._name);
-}
-
abstract class Pattern {
Iterable<Match> allMatches(String string, [int start = 0]);
}
@@ -610,6 +610,10 @@
throw '';
}
+abstract class Sink {
+ void close();
+}
+
class StackTrace {}
abstract class String implements Comparable<String>, Pattern {
@@ -1231,6 +1235,10 @@
Encoding? stderrEncoding,
});
}
+
+abstract class Socket {
+ void destroy() {}
+}
''',
)
],