Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(411)

Side by Side Diff: test/io_test.dart

Issue 2181743002: Always split collections and argument lists with trailing commas. (Closed) Base URL: https://github.com/dart-lang/dart_style.git@master
Patch Set: Revise. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lib/src/source_visitor.dart ('k') | test/regression/0200/0223.stmt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library dart_style.test.io; 5 library dart_style.test.io;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:io'; 8 import 'dart:io';
9 9
10 import 'package:dart_style/src/io.dart'; 10 import 'package:dart_style/src/io.dart';
11 import 'package:path/path.dart' as p; 11 import 'package:path/path.dart' as p;
12 import 'package:scheduled_test/descriptor.dart' as d; 12 import 'package:scheduled_test/descriptor.dart' as d;
13 import 'package:scheduled_test/scheduled_test.dart'; 13 import 'package:scheduled_test/scheduled_test.dart';
14 14
15 import 'package:dart_style/src/formatter_options.dart'; 15 import 'package:dart_style/src/formatter_options.dart';
16 16
17 import 'utils.dart'; 17 import 'utils.dart';
18 18
19 void main() { 19 void main() {
20 setUpTestSuite(); 20 setUpTestSuite();
21 21
22 var overwriteOptions = new FormatterOptions(OutputReporter.overwrite); 22 var overwriteOptions = new FormatterOptions(OutputReporter.overwrite);
23 23
24 var followOptions = 24 var followOptions =
25 new FormatterOptions(OutputReporter.overwrite, followLinks: true); 25 new FormatterOptions(OutputReporter.overwrite, followLinks: true);
26 26
27 test('handles directory ending in ".dart"', () { 27 test('handles directory ending in ".dart"', () {
28 d.dir('code.dart', [d.file('a.dart', unformattedSource),]).create(); 28 d.dir('code.dart', [
29 d.file('a.dart', unformattedSource),
30 ]).create();
29 31
30 schedule(() { 32 schedule(() {
31 var dir = new Directory(d.defaultRoot); 33 var dir = new Directory(d.defaultRoot);
32 processDirectory(overwriteOptions, dir); 34 processDirectory(overwriteOptions, dir);
33 }, 'Run formatter.'); 35 }, 'Run formatter.');
34 36
35 d.dir('code.dart', [d.file('a.dart', formattedSource)]).validate(); 37 d.dir('code.dart', [d.file('a.dart', formattedSource)]).validate();
36 }); 38 });
37 39
38 test("doesn't touch unchanged files", () { 40 test("doesn't touch unchanged files", () {
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 92
91 schedule(() { 93 schedule(() {
92 var dir = new Directory(p.join(d.defaultRoot, '.code')); 94 var dir = new Directory(p.join(d.defaultRoot, '.code'));
93 processDirectory(overwriteOptions, dir); 95 processDirectory(overwriteOptions, dir);
94 }, 'Run formatter.'); 96 }, 'Run formatter.');
95 97
96 d.dir('.code', [d.file('a.dart', formattedSource)]).validate(); 98 d.dir('.code', [d.file('a.dart', formattedSource)]).validate();
97 }); 99 });
98 100
99 test("doesn't follow directory symlinks by default", () { 101 test("doesn't follow directory symlinks by default", () {
100 d.dir('code', [d.file('a.dart', unformattedSource),]).create(); 102 d.dir('code', [
103 d.file('a.dart', unformattedSource),
104 ]).create();
101 105
102 d.dir('target_dir', [d.file('b.dart', unformattedSource),]).create(); 106 d.dir('target_dir', [
107 d.file('b.dart', unformattedSource),
108 ]).create();
103 109
104 schedule(() { 110 schedule(() {
105 // Create a link to the target directory in the code directory. 111 // Create a link to the target directory in the code directory.
106 new Link(p.join(d.defaultRoot, 'code', 'linked_dir')) 112 new Link(p.join(d.defaultRoot, 'code', 'linked_dir'))
107 .createSync(p.join(d.defaultRoot, 'target_dir')); 113 .createSync(p.join(d.defaultRoot, 'target_dir'));
108 }, 'Create symlinks.'); 114 }, 'Create symlinks.');
109 115
110 schedule(() { 116 schedule(() {
111 var dir = new Directory(p.join(d.defaultRoot, 'code')); 117 var dir = new Directory(p.join(d.defaultRoot, 'code'));
112 processDirectory(overwriteOptions, dir); 118 processDirectory(overwriteOptions, dir);
113 }, 'Run formatter.'); 119 }, 'Run formatter.');
114 120
115 d.dir('code', [ 121 d.dir('code', [
116 d.file('a.dart', formattedSource), 122 d.file('a.dart', formattedSource),
117 d.dir('linked_dir', [d.file('b.dart', unformattedSource),]) 123 d.dir('linked_dir', [
124 d.file('b.dart', unformattedSource),
125 ])
118 ]).validate(); 126 ]).validate();
119 }); 127 });
120 128
121 test("follows directory symlinks when 'followLinks' is true", () { 129 test("follows directory symlinks when 'followLinks' is true", () {
122 d.dir('code', [d.file('a.dart', unformattedSource),]).create(); 130 d.dir('code', [
131 d.file('a.dart', unformattedSource),
132 ]).create();
123 133
124 d.dir('target_dir', [d.file('b.dart', unformattedSource),]).create(); 134 d.dir('target_dir', [
135 d.file('b.dart', unformattedSource),
136 ]).create();
125 137
126 schedule(() { 138 schedule(() {
127 // Create a link to the target directory in the code directory. 139 // Create a link to the target directory in the code directory.
128 new Link(p.join(d.defaultRoot, 'code', 'linked_dir')) 140 new Link(p.join(d.defaultRoot, 'code', 'linked_dir'))
129 .createSync(p.join(d.defaultRoot, 'target_dir')); 141 .createSync(p.join(d.defaultRoot, 'target_dir'));
130 }); 142 });
131 143
132 schedule(() { 144 schedule(() {
133 var dir = new Directory(p.join(d.defaultRoot, 'code')); 145 var dir = new Directory(p.join(d.defaultRoot, 'code'));
134 processDirectory(followOptions, dir); 146 processDirectory(followOptions, dir);
135 }, 'running formatter'); 147 }, 'running formatter');
136 148
137 d.dir('code', [ 149 d.dir('code', [
138 d.file('a.dart', formattedSource), 150 d.file('a.dart', formattedSource),
139 d.dir('linked_dir', [d.file('b.dart', formattedSource),]) 151 d.dir('linked_dir', [
152 d.file('b.dart', formattedSource),
153 ])
140 ]).validate(); 154 ]).validate();
141 }); 155 });
142 156
143 if (!Platform.isWindows) { 157 if (!Platform.isWindows) {
144 test("doesn't follow file symlinks by default", () { 158 test("doesn't follow file symlinks by default", () {
145 d.dir('code').create(); 159 d.dir('code').create();
146 d.file('target_file.dart', unformattedSource).create(); 160 d.file('target_file.dart', unformattedSource).create();
147 161
148 schedule(() { 162 schedule(() {
149 // Create a link to the target file in the code directory. 163 // Create a link to the target file in the code directory.
150 new Link(p.join(d.defaultRoot, 'code', 'linked_file.dart')) 164 new Link(p.join(d.defaultRoot, 'code', 'linked_file.dart'))
151 .createSync(p.join(d.defaultRoot, 'target_file.dart')); 165 .createSync(p.join(d.defaultRoot, 'target_file.dart'));
152 }, 'Create symlinks.'); 166 }, 'Create symlinks.');
153 167
154 schedule(() { 168 schedule(() {
155 var dir = new Directory(p.join(d.defaultRoot, 'code')); 169 var dir = new Directory(p.join(d.defaultRoot, 'code'));
156 processDirectory(overwriteOptions, dir); 170 processDirectory(overwriteOptions, dir);
157 }, 'Run formatter.'); 171 }, 'Run formatter.');
158 172
159 d.dir( 173 d.dir('code', [
160 'code', [d.file('linked_file.dart', unformattedSource),]).validate(); 174 d.file('linked_file.dart', unformattedSource),
175 ]).validate();
161 }); 176 });
162 177
163 test("follows file symlinks when 'followLinks' is true", () { 178 test("follows file symlinks when 'followLinks' is true", () {
164 d.dir('code').create(); 179 d.dir('code').create();
165 d.file('target_file.dart', unformattedSource).create(); 180 d.file('target_file.dart', unformattedSource).create();
166 181
167 schedule(() { 182 schedule(() {
168 // Create a link to the target file in the code directory. 183 // Create a link to the target file in the code directory.
169 new Link(p.join(d.defaultRoot, 'code', 'linked_file.dart')) 184 new Link(p.join(d.defaultRoot, 'code', 'linked_file.dart'))
170 .createSync(p.join(d.defaultRoot, 'target_file.dart')); 185 .createSync(p.join(d.defaultRoot, 'target_file.dart'));
171 }); 186 });
172 187
173 schedule(() { 188 schedule(() {
174 var dir = new Directory(p.join(d.defaultRoot, 'code')); 189 var dir = new Directory(p.join(d.defaultRoot, 'code'));
175 processDirectory(followOptions, dir); 190 processDirectory(followOptions, dir);
176 }, 'running formatter'); 191 }, 'running formatter');
177 192
178 d.dir('code', [d.file('linked_file.dart', formattedSource),]).validate(); 193 d.dir('code', [
194 d.file('linked_file.dart', formattedSource),
195 ]).validate();
179 }); 196 });
180 } 197 }
181 } 198 }
OLDNEW
« no previous file with comments | « lib/src/source_visitor.dart ('k') | test/regression/0200/0223.stmt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698