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

Side by Side Diff: test/codegen_test.dart

Issue 968273002: Fixing layout in js output (use full paths rather than just the library name) (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: address review comments Created 5 years, 9 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/codegen/expect/typed_data/typed_data.js ('k') | test/sunflower/sunflower.html » ('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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 /// Tests code generation. 5 /// Tests code generation.
6 /// Runs Dart Dev Compiler on all input in the `codegen` directory and checks 6 /// Runs Dart Dev Compiler on all input in the `codegen` directory and checks
7 /// that the output is what we expected. 7 /// that the output is what we expected.
8 library ddc.test.codegen_test; 8 library ddc.test.codegen_test;
9 9
10 import 'dart:io'; 10 import 'dart:io';
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 test('devc $filename.dart', () { 78 test('devc $filename.dart', () {
79 compilerMessages.writeln('// Messages from compiling $filename.dart'); 79 compilerMessages.writeln('// Messages from compiling $filename.dart');
80 80
81 var result = compile(filePath, realSdk, options); 81 var result = compile(filePath, realSdk, options);
82 var success = !result.failure; 82 var success = !result.failure;
83 83
84 // Write compiler messages to disk. 84 // Write compiler messages to disk.
85 new File(path.join(actualDir, '$filename.txt')) 85 new File(path.join(actualDir, '$filename.txt'))
86 .writeAsStringSync(compilerMessages.toString()); 86 .writeAsStringSync(compilerMessages.toString());
87 87
88 var outputDir = new Directory(path.join(actualDir, filename)); 88 var outFile = dartGen
89 expect(outputDir.existsSync(), success, 89 ? new File(path.join(actualDir, '$filename/$filename.dart'))
90 reason: '${outputDir.path} was created iff compilation succeeds'); 90 : new File(path.join(actualDir, '$filename.js'));
91 expect(outFile.existsSync(), success,
92 reason: '${outFile.path} was created iff compilation succeeds');
91 93
92 // TODO(jmesserly): ideally we'd diff the output here. For now it 94 // TODO(jmesserly): ideally we'd diff the output here. For now it
93 // happens in the containing shell script. 95 // happens in the containing shell script.
94 }); 96 });
95 } 97 }
96 98
97 group('sdk', () { 99 group('sdk', () {
98 // The analyzer does not bubble exception messages for certain internal 100 // The analyzer does not bubble exception messages for certain internal
99 // dart:* library failures, such as failing to find 101 // dart:* library failures, such as failing to find
100 // "_internal/libraries.dart". Instead it produces an opaque "failed to 102 // "_internal/libraries.dart". Instead it produces an opaque "failed to
(...skipping 19 matching lines...) Expand all
120 forceCompile: true, 122 forceCompile: true,
121 outputDart: dartGen, 123 outputDart: dartGen,
122 formatOutput: dartGen, 124 formatOutput: dartGen,
123 cheapTestFormat: true, 125 cheapTestFormat: true,
124 emitSourceMaps: false); 126 emitSourceMaps: false);
125 var sdkPath = dartGen 127 var sdkPath = dartGen
126 ? path.join(testDir, '..', 'tool', 'input_sdk_src') 128 ? path.join(testDir, '..', 'tool', 'input_sdk_src')
127 : path.join(testDir, 'generated_sdk'); 129 : path.join(testDir, 'generated_sdk');
128 var testSdk = new TypeResolver.fromDir(sdkPath, options); 130 var testSdk = new TypeResolver.fromDir(sdkPath, options);
129 compile('dart:core', testSdk, options); 131 compile('dart:core', testSdk, options);
130 var outputDir = new Directory(path.join(actualDir, 'core')); 132 var outFile = dartGen
131 expect(outputDir.existsSync(), true, 133 ? new File(path.join(actualDir, 'core/core'))
132 reason: '${outputDir.path} was created for dart:core'); 134 : new File(path.join(actualDir, 'dart/core.js'));
135 expect(outFile.existsSync(), true,
136 reason: '${outFile.path} was created for dart:core');
133 }); 137 });
134 }); 138 });
135 139
136 if (!dartGen) { 140 if (!dartGen) {
137 test('devc jscodegen html_input.html', () { 141 test('devc jscodegen html_input.html', () {
138 var filePath = path.join(inputDir, 'html_input.html'); 142 var filePath = path.join(inputDir, 'html_input.html');
139 compilerMessages.writeln('// Messages from compiling html_input.html'); 143 compilerMessages.writeln('// Messages from compiling html_input.html');
140 144
141 var result = compile(filePath, realSdk, options); 145 var result = compile(filePath, realSdk, options);
142 var success = !result.failure; 146 var success = !result.failure;
(...skipping 15 matching lines...) Expand all
158 print('[AnalysisEngine] error $message $exception'); 162 print('[AnalysisEngine] error $message $exception');
159 } 163 }
160 164
161 @override void logError2(String message, Object exception) { 165 @override void logError2(String message, Object exception) {
162 print('[AnalysisEngine] error $message $exception'); 166 print('[AnalysisEngine] error $message $exception');
163 } 167 }
164 168
165 void logInformation(String message, [CaughtException exception]) {} 169 void logInformation(String message, [CaughtException exception]) {}
166 void logInformation2(String message, Object exception) {} 170 void logInformation2(String message, Object exception) {}
167 } 171 }
OLDNEW
« no previous file with comments | « test/codegen/expect/typed_data/typed_data.js ('k') | test/sunflower/sunflower.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698