这是indexloc提供的服务,不要输入任何密码
Skip to content

Remove mocks from compile_expression_test #78092

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

Merged
merged 1 commit into from
Mar 15, 2021

Conversation

jmagman
Copy link
Member

@jmagman jmagman commented Mar 13, 2021

In compile_expression_test replace MockStdIn with MemoryIOSink. Add convenience methods on MemoryIOSink to easily get and clear the string written to stdin, and adopt the new methods in a few places.

Part of #71511

@jmagman jmagman added the c: contributor-productivity Team-specific productivity, code health, technical debt. label Mar 13, 2021
@jmagman jmagman self-assigned this Mar 13, 2021
@flutter-dashboard flutter-dashboard bot added the tool Affects the "flutter" command-line tool. See also t: labels. label Mar 13, 2021
@google-cla google-cla bot added the cla: yes label Mar 13, 2021
writes.clear();
}

String getAndClear() {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adopted from

String getAndClear() {
final String result = stdInWrites.toString();
stdInWrites.clear();
return result;
}

I could be convinced that the clear method is unnecessary, but getting the string is convenient.

Comment on lines -59 to -61
stdErrStreamController = StreamController<String>();
when(mockFrontendServerStdErr.transform<String>(any))
.thenAnswer((Invocation invocation) => stdErrStreamController.stream);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This extra MockStream redirection was unnecessary, directly look up mockFrontendServer.stderr to the stdErrStreamController StreamController.

@fluttergithubbot
Copy link
Contributor

This pull request is not suitable for automatic merging in its current state.

  • Please get at least one approved review before re-applying this label. Reviewers: If you left a comment approving, please use the "approve" review action instead.

Copy link
Contributor

@jonahwilliams jonahwilliams left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jmagman jmagman merged commit 628ae57 into flutter:master Mar 15, 2021
@jmagman jmagman deleted the memory-ios-sink branch March 15, 2021 23:06
@jmagman jmagman added the c: tech-debt Technical debt, code quality, testing, etc. label Aug 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: contributor-productivity Team-specific productivity, code health, technical debt. c: tech-debt Technical debt, code quality, testing, etc. tool Affects the "flutter" command-line tool. See also t: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants