@@ -234,22 +234,39 @@ void main() {
234
234
});
235
235
236
236
group ("fix" , () {
237
- // TODO(rnystrom): This will get more useful when other fixes are supported.
238
237
test ("--fix applies all fixes" , () async {
239
238
var process = await runFormatter (["--fix" ]);
240
- process.stdin.writeln ("foo({a:1}) {}" );
239
+ process.stdin.writeln ("foo({a:1}) {" );
240
+ process.stdin.writeln (" new Bar();}" );
241
241
await process.stdin.close ();
242
242
243
- expect (await process.stdout.next, "foo({a = 1}) {}" );
243
+ expect (await process.stdout.next, "foo({a = 1}) {" );
244
+ expect (await process.stdout.next, " Bar();" );
245
+ expect (await process.stdout.next, "}" );
244
246
await process.shouldExit (0 );
245
247
});
246
248
247
249
test ("--fix-named-default-separator" , () async {
248
250
var process = await runFormatter (["--fix-named-default-separator" ]);
249
- process.stdin.writeln ("foo({a:1}) {}" );
251
+ process.stdin.writeln ("foo({a:1}) {" );
252
+ process.stdin.writeln (" new Bar();}" );
250
253
await process.stdin.close ();
251
254
252
- expect (await process.stdout.next, "foo({a = 1}) {}" );
255
+ expect (await process.stdout.next, "foo({a = 1}) {" );
256
+ expect (await process.stdout.next, " new Bar();" );
257
+ expect (await process.stdout.next, "}" );
258
+ await process.shouldExit (0 );
259
+ });
260
+
261
+ test ("--fix-optional-new" , () async {
262
+ var process = await runFormatter (["--fix-optional-new" ]);
263
+ process.stdin.writeln ("foo({a:1}) {" );
264
+ process.stdin.writeln (" new Bar();}" );
265
+ await process.stdin.close ();
266
+
267
+ expect (await process.stdout.next, "foo({a: 1}) {" );
268
+ expect (await process.stdout.next, " Bar();" );
269
+ expect (await process.stdout.next, "}" );
253
270
await process.shouldExit (0 );
254
271
});
255
272
0 commit comments