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

Side by Side Diff: pkg/kernel/test/baseline_tester.dart

Issue 2665723002: Implement canonical name scheme in kernel. (Closed)
Patch Set: Address comments Created 3 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
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 import 'dart:io'; 4 import 'dart:io';
5 5
6 import 'package:kernel/analyzer/loader.dart'; 6 import 'package:kernel/analyzer/loader.dart';
7 import 'package:kernel/application_root.dart'; 7 import 'package:kernel/application_root.dart';
8 import 'package:kernel/kernel.dart'; 8 import 'package:kernel/kernel.dart';
9 import 'package:kernel/target/targets.dart'; 9 import 'package:kernel/target/targets.dart';
10 import 'package:kernel/text/ast_to_text.dart'; 10 import 'package:kernel/text/ast_to_text.dart';
(...skipping 24 matching lines...) Expand all
35 for (FileSystemEntity file in directory.listSync()) { 35 for (FileSystemEntity file in directory.listSync()) {
36 if (file is File && file.path.endsWith('.dart')) { 36 if (file is File && file.path.endsWith('.dart')) {
37 String name = pathlib.basename(file.path); 37 String name = pathlib.basename(file.path);
38 test(name, () async { 38 test(name, () async {
39 Uri dartPath = 39 Uri dartPath =
40 new Uri(scheme: 'file', path: pathlib.absolute(file.path)); 40 new Uri(scheme: 'file', path: pathlib.absolute(file.path));
41 String shortName = pathlib.withoutExtension(name); 41 String shortName = pathlib.withoutExtension(name);
42 String filenameOfBaseline = '$outputDirectory/$shortName.baseline.txt'; 42 String filenameOfBaseline = '$outputDirectory/$shortName.baseline.txt';
43 String filenameOfCurrent = '$outputDirectory/$shortName.current.txt'; 43 String filenameOfCurrent = '$outputDirectory/$shortName.current.txt';
44 44
45 var repository = new Repository(); 45 var program = new Program();
46 var loader = await batch.getLoader( 46 var loader = await batch.getLoader(
47 repository, 47 program,
48 new DartOptions( 48 new DartOptions(
49 strongMode: target.strongMode, 49 strongMode: target.strongMode,
50 sdk: sdkDirectory, 50 sdk: sdkDirectory,
51 declaredVariables: target.extraDeclaredVariables, 51 declaredVariables: target.extraDeclaredVariables,
52 applicationRoot: applicationRoot)); 52 applicationRoot: applicationRoot));
53 var program = loader.loadProgram(dartPath, target: target); 53 loader.loadProgram(dartPath, target: target);
54 verifyProgram(program); 54 verifyProgram(program);
55 var errors = target.transformProgram(program); 55 var errors = target.transformProgram(program);
56 verifyProgram(program); 56 verifyProgram(program);
57 57
58 var buffer = new StringBuffer(); 58 var buffer = new StringBuffer();
59 for (var error in errors) { 59 for (var error in errors) {
60 buffer.writeln('// $error'); 60 buffer.writeln('// $error');
61 } 61 }
62 new Printer(buffer, annotator: target.annotator) 62 new Printer(buffer, annotator: target.annotator)
63 .writeLibraryFile(program.mainMethod.enclosingLibrary); 63 .writeLibraryFile(program.mainMethod.enclosingLibrary);
(...skipping 11 matching lines...) Expand all
75 ' rm $filenameOfBaseline\n' 75 ' rm $filenameOfBaseline\n'
76 'Command to see the diff:\n' 76 'Command to see the diff:\n'
77 ' diff -cd $outputDirectory/$shortName.{baseline,current}.txt' 77 ' diff -cd $outputDirectory/$shortName.{baseline,current}.txt'
78 '\n'); 78 '\n');
79 } 79 }
80 } 80 }
81 }); 81 });
82 } 82 }
83 } 83 }
84 } 84 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698