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

Side by Side Diff: packages/dart_style/test/utils.dart

Issue 1400473008: Roll Observatory packages and add a roll script (Closed) Base URL: git@github.com:dart-lang/observatory_pub_packages.git@master
Patch Set: Created 5 years, 2 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
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 library dart_style.test.utils;
6
7 import 'dart:io';
8
9 import 'package:path/path.dart' as p;
10 import 'package:scheduled_test/descriptor.dart' as d;
11 import 'package:scheduled_test/scheduled_process.dart';
12 import 'package:scheduled_test/scheduled_test.dart';
13
14 const unformattedSource = 'void main() => print("hello") ;';
15 const formattedSource = 'void main() => print("hello");\n';
16
17 /// Runs the command line formatter, passing it [args].
18 ScheduledProcess runFormatter([List<String> args]) {
19 if (args == null) args = [];
20
21 var formatterPath = p.join("bin", "format.dart");
22
23 args.insert(0, formatterPath);
24
25 // Use the same package root, if there is one.
26 if (Platform.packageRoot.isNotEmpty) {
27 args.insert(0, "--package-root=${Platform.packageRoot}");
28 }
29
30 return new ScheduledProcess.start(Platform.executable, args);
31 }
32
33 /// Runs the command line formatter, passing it the test directory followed by
34 /// [args].
35 ScheduledProcess runFormatterOnDir([List<String> args]) {
36 if (args == null) args = [];
37 return runFormatter([d.defaultRoot]..addAll(args));
38 }
39
40 /// Set up the scheduled test suite.
41 ///
42 /// Configures the unit test output and makes a sandbox directory for the
43 /// scheduled tests to run in.
44 void setUpTestSuite() {
45 // Make a sandbox directory for the scheduled tests to run in.
46 setUp(() {
47 var tempDir = Directory.systemTemp.createTempSync('dart_style.test.');
48 d.defaultRoot = tempDir.path;
49
50 currentSchedule.onComplete.schedule(() {
51 d.defaultRoot = null;
52 return tempDir.delete(recursive: true);
53 });
54 });
55 }
OLDNEW
« no previous file with comments | « packages/dart_style/test/splitting/variables.stmt ('k') | packages/dart_style/test/whitespace/._blocks.stmt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698