-
Notifications
You must be signed in to change notification settings - Fork 164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generated fakes for BuildContext do not include additional parameters for toString #371
Comments
Similar to #354. |
I think #342 might offer a solution to this problem, once implemented. |
srawlins
added a commit
that referenced
this issue
Jun 4, 2021
…ch the signature of an overriding method which adds optional parameters. Fixes #371 PiperOrigin-RevId: 377388828
srawlins
added a commit
that referenced
this issue
Jun 4, 2021
…ch the signature of an overriding method which adds optional parameters. Fixes #371 PiperOrigin-RevId: 377388828
srawlins
added a commit
that referenced
this issue
Jun 4, 2021
…ch the signature of an overriding method which adds optional parameters. Fixes #371 PiperOrigin-RevId: 377388828
@srawlins It appears that this problem still persists in 5.0.10. Including my minimal repro, and logs: import 'package:flutter/foundation.dart';
import 'package:mockito/annotations.dart';
part 'test_test.mocks.dart';
class Foo implements Diagnosticable {
@override
void debugFillProperties(DiagnosticPropertiesBuilder properties) {}
@override
DiagnosticsNode toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) {
return DiagnosticsNode.message('Foo');
}
@override
String toStringShort() => toString();
@override
String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) {
return super.toString();
}
}
@GenerateMocks([Foo])
void main(List<String> args) {
} Logs from `flutter pub run build_runner build --delete-conflicting-outputs --verbose`:
|
Meanwhile we can exclude generated files.
|
I think I have an additional fix for this, coming. |
same here when generate a Widget |
mosuem
pushed a commit
to dart-lang/test
that referenced
this issue
Oct 17, 2024
…ch the signature of an overriding method which adds optional parameters. Fixes dart-lang/mockito#371 PiperOrigin-RevId: 377388828
mosuem
pushed a commit
to dart-lang/test
that referenced
this issue
Oct 17, 2024
* Properly reference types in overridden `toString` implementations. Fixes dart-lang/mockito#438 * Override `toString` in a Fake implementation when the class-to-be-faked has a superclass which overrides `toString` with additional parameters. Fixes dart-lang/mockito#371 PiperOrigin-RevId: 385852381
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If one tries to generate a mock for BuildContext class, the result mock contains errors.
Steps to reproduce
Expected behaviour
An usable MockBuildContext is generated.
Actual behaviour
The following lines of the generated class contains errors:
Errors:
The text was updated successfully, but these errors were encountered: