File tree Expand file tree Collapse file tree 2 files changed +50
-2
lines changed
pkg/dartdev/test/commands Expand file tree Collapse file tree 2 files changed +50
-2
lines changed Original file line number Diff line number Diff line change @@ -11,5 +11,53 @@ void main() {
1111}
1212
1313void defineFix () {
14- // todo (pq): add tests when the `fix` command is enabled.
14+ TestProject p;
15+
16+ setUp (() => p = null );
17+
18+ tearDown (() => p? .dispose ());
19+
20+ test ('none' , () {
21+ p = project (mainSrc: 'int get foo => 1;\n ' );
22+ var result = p.runSync ('fix' , [p.dirPath]);
23+ expect (result.exitCode, 0 );
24+ expect (result.stderr, isEmpty);
25+ expect (result.stdout, contains ('Nothing to fix!' ));
26+ });
27+
28+ test ('no args' , () {
29+ p = project (
30+ mainSrc: '''
31+ var x = "";
32+ ''' ,
33+ analysisOptions: '''
34+ linter:
35+ rules:
36+ - prefer_single_quotes
37+ ''' ,
38+ );
39+ var result = p.runSync ('fix' , [], workingDir: p.dirPath);
40+ expect (result.exitCode, 0 );
41+ expect (result.stderr, isEmpty);
42+ expect (result.stdout, contains ('Fixed 1 files.' ));
43+ });
44+
45+ test ('.' , () {
46+ p = project (
47+ mainSrc: '''
48+ var x = "";
49+ ''' ,
50+ analysisOptions: '''
51+ linter:
52+ rules:
53+ - prefer_single_quotes
54+ ''' ,
55+ );
56+ var result = p.runSync ('fix' , ['.' ], workingDir: p.dirPath);
57+ expect (result.exitCode, 0 );
58+ expect (result.stderr, isEmpty);
59+ expect (result.stdout, contains ('Fixed 1 files.' ));
60+ });
61+
62+ // todo (pq): add tests for analyzer excludes, ignores, etc.
1563}
Original file line number Diff line number Diff line change @@ -27,5 +27,5 @@ CHANNEL dev
2727MAJOR 2
2828MINOR 11
2929PATCH 0
30- PRERELEASE 241
30+ PRERELEASE 242
3131PRERELEASE_PATCH 0
You can’t perform that action at this time.
0 commit comments