This repository was archived by the owner on Dec 9, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +34
-2
lines changed
lib/src/backends/record_replay Expand file tree Collapse file tree 4 files changed +34
-2
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ abstract class ProxyObject {}
1212/// This is used when a caller accesses a method on a [ProxyObject] via the
1313/// method's getter. In these cases, the caller will receive a [MethodProxy]
1414/// that allows delayed invocation of the method.
15- class MethodProxy extends Object implements Function {
15+ class MethodProxy {
1616 /// The object on which the method was retrieved.
1717 ///
1818 /// This will be the target object when this method proxy is invoked.
Original file line number Diff line number Diff line change @@ -36,6 +36,22 @@ import 'replay_file_system.dart';
3636/// assertions in your tests about which methods were invoked and in what
3737/// order.
3838///
39+ /// *Implementation note*: this class uses [noSuchMethod] to dynamically handle
40+ /// invocations. As a result, method references on objects herein will not pass
41+ /// `is` checks or checked-mode checks on type. For example:
42+ ///
43+ /// ```dart
44+ /// typedef FileStat StatSync(String path);
45+ /// FileSystem fs = new RecordingFileSystem(delegate: delegate, destination: dir);
46+ ///
47+ /// StatSync method = fs.statSync; // Will fail in checked-mode
48+ /// fs.statSync is StatSync // Will return false
49+ /// fs.statSync is Function // Will return false
50+ ///
51+ /// dynamic method2 = fs.statSync; // OK
52+ /// FileStat stat = method2('/path'); // OK
53+ /// ```
54+ ///
3955/// See also:
4056/// - [ReplayFileSystem]
4157abstract class RecordingFileSystem extends FileSystem {
Original file line number Diff line number Diff line change @@ -41,6 +41,22 @@ import 'replay_proxy_mixin.dart';
4141/// assertions in your tests about which methods were invoked and in what
4242/// order.
4343///
44+ /// *Implementation note*: this class uses [noSuchMethod] to dynamically handle
45+ /// invocations. As a result, method references on objects herein will not pass
46+ /// `is` checks or checked-mode checks on type. For example:
47+ ///
48+ /// ```dart
49+ /// typedef FileStat StatSync(String path);
50+ /// FileSystem fs = new ReplayFileSystem(directory);
51+ ///
52+ /// StatSync method = fs.statSync; // Will fail in checked-mode
53+ /// fs.statSync is StatSync // Will return false
54+ /// fs.statSync is Function // Will return false
55+ ///
56+ /// dynamic method2 = fs.statSync; // OK
57+ /// FileStat stat = method2('/path'); // OK
58+ /// ```
59+ ///
4460/// See also:
4561/// - [RecordingFileSystem]
4662abstract class ReplayFileSystem extends FileSystem {
Original file line number Diff line number Diff line change @@ -2276,7 +2276,7 @@ void runCommonTests(
22762276 });
22772277
22782278 test ('blocksCallToFlushWhileStreamIsActive' , () {
2279- expect (sink.flush, throwsStateError);
2279+ expect (() => sink.flush () , throwsStateError);
22802280 });
22812281 });
22822282 });
You can’t perform that action at this time.
0 commit comments