@@ -23,8 +23,7 @@ void main() {
23
23
const String flutterRoot = '/flutter' ;
24
24
const String checkoutsParentDirectory = '$flutterRoot /dev/tools/' ;
25
25
const String githubUsername = 'user' ;
26
- const String frameworkMirror =
27
- '[email protected] :$githubUsername /flutter.git' ;
26
+ const String frameworkMirror
= '[email protected] :$githubUsername /flutter.git' ;
28
27
const String engineMirror
= '[email protected] :$githubUsername /engine.git' ;
29
28
const String candidateBranch = 'flutter-1.2-candidate.3' ;
30
29
const String releaseChannel = 'beta' ;
@@ -76,6 +75,85 @@ void main() {
76
75
return CommandRunner <void >('codesign-test' , '' )..addCommand (command);
77
76
}
78
77
78
+ group ('start arg parser' , () {
79
+ const String nextDartRevision =
80
+ 'f6c91128be6b77aef8351e1e3a9d07c85bc2e46e' ;
81
+ late StartCommand startCommand;
82
+ setUp (() {
83
+ final String operatingSystem = const LocalPlatform ().operatingSystem;
84
+ final Map <String , String > environment = < String , String > {
85
+ 'HOME' : '/path/to/user/home' ,
86
+ };
87
+ final Directory homeDir = fileSystem.directory (
88
+ environment['HOME' ],
89
+ );
90
+ // Tool assumes this exists
91
+ homeDir.createSync (recursive: true );
92
+ platform = FakePlatform (
93
+ environment: environment,
94
+ operatingSystem: operatingSystem,
95
+ pathSeparator: '/' ,
96
+ );
97
+ processManager = FakeProcessManager .list (< FakeCommand > []);
98
+ checkouts = Checkouts (
99
+ fileSystem: fileSystem,
100
+ parentDirectory: fileSystem.directory (checkoutsParentDirectory),
101
+ platform: platform,
102
+ processManager: processManager,
103
+ stdio: stdio,
104
+ );
105
+ startCommand = StartCommand (
106
+ checkouts: checkouts, conductorVersion: conductorVersion);
107
+ });
108
+
109
+ test ('default args' , () async {
110
+ final List <String > args = < String > [
111
+ 'start' ,
112
+ '--$kCandidateOption ' ,
113
+ candidateBranch,
114
+ '--$kReleaseOption ' ,
115
+ 'stable' ,
116
+ '--$kStateOption ' ,
117
+ '/path/to/statefile.json' ,
118
+ '--$kDartRevisionOption ' ,
119
+ nextDartRevision,
120
+ '--$kGithubUsernameOption ' ,
121
+ githubUsername,
122
+ ];
123
+ final StartContext context =
124
+ startCommand.createContext (startCommand.argParser.parse (args));
125
+ expect (context.frameworkUpstream, FrameworkRepository .defaultUpstream);
126
+ expect (context.frameworkMirror, contains (githubUsername));
127
+ expect (context.frameworkMirror, contains ('/flutter.git' ));
128
+ expect (context.engineUpstream, EngineRepository .defaultUpstream);
129
+ });
130
+
131
+ test ('overridden mirror' , () async {
132
+ const String customFrameworkMirror =
133
+ '[email protected] :$githubUsername /flutter-work.git' ;
134
+ final List <String > args = < String > [
135
+ 'start' ,
136
+ '--$kCandidateOption ' ,
137
+ candidateBranch,
138
+ '--$kReleaseOption ' ,
139
+ 'stable' ,
140
+ '--$kStateOption ' ,
141
+ '/path/to/statefile.json' ,
142
+ '--$kDartRevisionOption ' ,
143
+ nextDartRevision,
144
+ '--$kGithubUsernameOption ' ,
145
+ githubUsername,
146
+ '--$kFrameworkMirrorOption ' ,
147
+ customFrameworkMirror,
148
+ ];
149
+ final StartContext context =
150
+ startCommand.createContext (startCommand.argParser.parse (args));
151
+ expect (
152
+ context.frameworkMirror, customFrameworkMirror
153
+ );
154
+ });
155
+ });
156
+
79
157
test ('throws exception if run from Windows' , () async {
80
158
final CommandRunner <void > runner = createRunner (
81
159
commands: < FakeCommand > [
0 commit comments