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

Side by Side Diff: benchmark/benchmark.dart

Issue 822273004: Add API to provide a selection range, and return the updated selection after formatting. (Closed) Base URL: https://github.com/dart-lang/dart_style.git@master
Patch Set: Remove redundant argument check. Created 5 years, 11 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 | « no previous file | lib/src/chunk.dart » ('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.benchmark.benchmark; 5 library dart_style.benchmark.benchmark;
6 6
7 import 'dart:io'; 7 import 'dart:io';
8 8
9 import 'package:dart_style/dart_style.dart'; 9 import 'package:dart_style/dart_style.dart';
10 10
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 53
54 return result; 54 return result;
55 } 55 }
56 56
57 void formatSource() { 57 void formatSource() {
58 var formatter = new DartFormatter(); 58 var formatter = new DartFormatter();
59 var result = formatter.format(source); 59 var result = formatter.format(source);
60 60
61 // Sanity check to make sure the output is what we expect and to make sure 61 // Sanity check to make sure the output is what we expect and to make sure
62 // the VM doesn't optimize "dead" code away. 62 // the VM doesn't optimize "dead" code away.
63 if (result.length != 29796) { 63 if (result.length != 29791) {
64 print("Incorrect output (length ${result.length}):\n$result"); 64 print("Incorrect output (length ${result.length}):\n$result");
65 exit(1); 65 exit(1);
66 } 66 }
67 } 67 }
68 68
69 const source = r""" 69 const source = r"""
70 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 70 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
71 // for details. All rights reserved. Use of this source code is governed by a 71 // for details. All rights reserved. Use of this source code is governed by a
72 // BSD-style license that can be found in the LICENSE file. 72 // BSD-style license that can be found in the LICENSE file.
73 73
(...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after
876 /// Throws a [SolveFailure] if not. 876 /// Throws a [SolveFailure] if not.
877 void _validateSdkConstraint(Pubspec pubspec) { 877 void _validateSdkConstraint(Pubspec pubspec) {
878 if (pubspec.environment.sdkVersion.allows(sdk.version)) return; 878 if (pubspec.environment.sdkVersion.allows(sdk.version)) return;
879 879
880 throw new BadSdkVersionException( 880 throw new BadSdkVersionException(
881 pubspec.name, 881 pubspec.name,
882 'Package ${pubspec.name} requires SDK version ' 882 'Package ${pubspec.name} requires SDK version '
883 '${pubspec.environment.sdkVersion} but the current SDK is ' '${sdk.ver sion}.'); 883 '${pubspec.environment.sdkVersion} but the current SDK is ' '${sdk.ver sion}.');
884 } 884 }
885 """; 885 """;
OLDNEW
« no previous file with comments | « no previous file | lib/src/chunk.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698