In "flutter create", use the project directory in the suggested "cd" command instead of the main source file path#173132
Conversation
…command instead of the main source file path
There was a problem hiding this comment.
Code Review
This pull request correctly changes the suggested cd command in flutter create to use the project directory path instead of the main source file path. The accompanying test change is also an improvement. I've suggested a small refinement to the test to make it more robust.
| RegExp cdLine = RegExp(r'^ \$ cd .*flutter_project$', multiLine: true); | ||
| expect(cdLine.hasMatch(logger.statusText), isTrue); |
There was a problem hiding this comment.
This is a good improvement to make the test more specific. To make it even more robust and less reliant on hardcoded strings, you could construct the expected path from the projectDir variable. This avoids hardcoding flutter_project and ensures the test correctly handles any changes to the test setup or relative path generation.1
final String expectedPath = globals.fs.path.relative(projectDir.path);
final RegExp cdLine = RegExp(r'^ \$ cd ' + RegExp.escape(expectedPath) + r'$', multiLine: true);
expect(cdLine.hasMatch(logger.statusText), isTrue, reason: 'statusText does not contain "cd $expectedPath"');
Style Guide References
Footnotes
|
If this made it into 3.35 we should probably cherrypick it (to beta) after merging. |
|
This issue does not affect the 3.35 branch. |
…ed "cd" command instead of the main source file path (flutter/flutter#173132)
…ed "cd" command instead of the main source file path (flutter/flutter#173132)
…ed "cd" command instead of the main source file path (flutter/flutter#173132)
…ed "cd" command instead of the main source file path (flutter/flutter#173132)
…ed "cd" command instead of the main source file path (flutter/flutter#173132)
…command instead of the main source file path (flutter#173132)
…command instead of the main source file path (flutter#173132)
…command instead of the main source file path (flutter#173132)
…command instead of the main source file path (flutter#173132)
…ed "cd" command instead of the main source file path (flutter/flutter#173132)
…command instead of the main source file path (flutter#173132)
No description provided.