Skip to content

Commit

Permalink
[analyzer] Add Sink and Socket to mock_sdk
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Phil Quitslund <[email protected]>
Reviewed-by: Konstantin Shcheglov <[email protected]>
  • Loading branch information
srawlins authored and Commit Queue committed Jan 19, 2023
1 parent 1110192 commit 4871e74
Showing 1 changed file with 19 additions and 11 deletions.
30 changes: 19 additions & 11 deletions pkg/analyzer/lib/src/test_utilities/mock_sdk.dart
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,17 @@ class Duration implements Comparable<Duration> {
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) => '';
Expand Down Expand Up @@ -567,17 +578,6 @@ class Object {
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]);
}
Expand Down Expand Up @@ -610,6 +610,10 @@ abstract class Set<E> implements Iterable<E> {
throw '';
}
abstract class Sink {
void close();
}
class StackTrace {}
abstract class String implements Comparable<String>, Pattern {
Expand Down Expand Up @@ -1231,6 +1235,10 @@ abstract class Process {
Encoding? stderrEncoding,
});
}
abstract class Socket {
void destroy() {}
}
''',
)
],
Expand Down

0 comments on commit 4871e74

Please sign in to comment.