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

Side by Side Diff: test/utils.dart

Issue 960113004: More fixing tests to make bots happy. (Closed) Base URL: https://github.com/dart-lang/dart_style.git@master
Patch Set: Created 5 years, 10 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 | « test/command_line_test.dart ('k') | no next file » | 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.utils; 5 library dart_style.test.utils;
6 6
7 import 'dart:io'; 7 import 'dart:io';
8 8
9 import 'package:path/path.dart' as p; 9 import 'package:path/path.dart' as p;
10 import 'package:scheduled_test/descriptor.dart' as d; 10 import 'package:scheduled_test/descriptor.dart' as d;
11 import 'package:scheduled_test/scheduled_process.dart'; 11 import 'package:scheduled_test/scheduled_process.dart';
12 import 'package:scheduled_test/scheduled_test.dart'; 12 import 'package:scheduled_test/scheduled_test.dart';
13 import 'package:unittest/compact_vm_config.dart'; 13 import 'package:unittest/compact_vm_config.dart';
14 14
15 const unformattedSource = 'void main() => print("hello") ;'; 15 const unformattedSource = 'void main() => print("hello") ;';
16 const formattedSource = 'void main() => print("hello");\n'; 16 const formattedSource = 'void main() => print("hello");\n';
17 17
18 /// Runs the command line formatter, passing it [args]. 18 /// Runs the command line formatter, passing it [args].
19 ScheduledProcess runFormatter([List<String> args]) { 19 ScheduledProcess runFormatter([List<String> args]) {
20 if (args == null) args = []; 20 if (args == null) args = [];
21 21
22 var formatterPath = p.join( 22 var formatterPath = p.join(
23 p.dirname(p.fromUri(Platform.script)), "..", "bin", "format.dart"); 23 p.dirname(p.fromUri(Platform.script)), "..", "bin", "format.dart");
24 24
25 args.insertAll(0, ["--package-root=${Platform.packageRoot}", formatterPath]); 25 args.insert(0, formatterPath);
26
27 // Use the same package root, if there is one.
28 if (Platform.packageRoot.isNotEmpty) {
29 args.insert(0, "--package-root=${Platform.packageRoot}");
30 }
31
26 return new ScheduledProcess.start(Platform.executable, args); 32 return new ScheduledProcess.start(Platform.executable, args);
27 } 33 }
28 34
29 /// Runs the command line formatter, passing it the test directory followed by 35 /// Runs the command line formatter, passing it the test directory followed by
30 /// [args]. 36 /// [args].
31 ScheduledProcess runFormatterOnDir([List<String> args]) { 37 ScheduledProcess runFormatterOnDir([List<String> args]) {
32 if (args == null) args = []; 38 if (args == null) args = [];
33 return runFormatter([d.defaultRoot]..addAll(args)); 39 return runFormatter([d.defaultRoot]..addAll(args));
34 } 40 }
35 41
(...skipping 11 matching lines...) Expand all
47 setUp(() { 53 setUp(() {
48 var tempDir = Directory.systemTemp.createTempSync('dart_style.test.'); 54 var tempDir = Directory.systemTemp.createTempSync('dart_style.test.');
49 d.defaultRoot = tempDir.path; 55 d.defaultRoot = tempDir.path;
50 56
51 currentSchedule.onComplete.schedule(() { 57 currentSchedule.onComplete.schedule(() {
52 d.defaultRoot = null; 58 d.defaultRoot = null;
53 return tempDir.delete(recursive: true); 59 return tempDir.delete(recursive: true);
54 }); 60 });
55 }); 61 });
56 } 62 }
OLDNEW
« no previous file with comments | « test/command_line_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698