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

Side by Side Diff: tools/testing/dart/multitest.dart

Issue 1028453002: Support percent encoded data URIs in the standalone embedder. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: add negative tests, make multitest understand data uris, fix test in checked mode 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 | Annotate | Revision Log
« no previous file with comments | « runtime/tests/vm/dart/data_uri_spawn_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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 multitest; 5 library multitest;
6 6
7 import "dart:async"; 7 import "dart:async";
8 import "dart:io"; 8 import "dart:io";
9 9
10 import "path.dart"; 10 import "path.dart";
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 Map<String, Set<String>> outcomes) { 66 Map<String, Set<String>> outcomes) {
67 // Read the entire file into a byte buffer and transform it to a 67 // Read the entire file into a byte buffer and transform it to a
68 // String. This will treat the file as ascii but the only parts 68 // String. This will treat the file as ascii but the only parts
69 // we are interested in will be ascii in any case. 69 // we are interested in will be ascii in any case.
70 List bytes = new File(filePath.toNativePath()).readAsBytesSync(); 70 List bytes = new File(filePath.toNativePath()).readAsBytesSync();
71 String contents = decodeUtf8(bytes); 71 String contents = decodeUtf8(bytes);
72 int first_newline = contents.indexOf('\n'); 72 int first_newline = contents.indexOf('\n');
73 final String line_separator = 73 final String line_separator =
74 (first_newline == 0 || contents[first_newline - 1] != '\r') 74 (first_newline == 0 || contents[first_newline - 1] != '\r')
75 ? '\n' 75 ? '\n'
76 : '\r\n'; 76 : '\R\n';
Ivan Posva 2015/03/20 19:54:58 ?
rmacnak 2015/03/20 20:11:28 Unintentional.
77 List<String> lines = contents.split(line_separator); 77 List<String> lines = contents.split(line_separator);
78 if (lines.last == '') lines.removeLast(); 78 if (lines.last == '') lines.removeLast();
79 bytes = null; 79 bytes = null;
80 contents = null; 80 contents = null;
81 Set<String> validMultitestOutcomes = new Set<String>.from( 81 Set<String> validMultitestOutcomes = new Set<String>.from(
82 ['ok', 'compile-time error', 'runtime error', 82 ['ok', 'compile-time error', 'runtime error',
83 'static type warning', 'dynamic type error', 83 'static type warning', 'dynamic type error',
84 'checked mode compile-time error']); 84 'checked mode compile-time error']);
85 85
86 List<String> testTemplate = new List<String>(); 86 List<String> testTemplate = new List<String>();
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 // Find all relative imports and copy them into the dir that contains 178 // Find all relative imports and copy them into the dir that contains
179 // the generated tests. 179 // the generated tests.
180 Set<String> _findAllRelativeImports(Path topLibrary) { 180 Set<String> _findAllRelativeImports(Path topLibrary) {
181 Set<Path> toSearch = new Set<Path>.from([topLibrary]); 181 Set<Path> toSearch = new Set<Path>.from([topLibrary]);
182 Set<String> foundImports = new Set<String>(); 182 Set<String> foundImports = new Set<String>();
183 Path libraryDir = topLibrary.directoryPath; 183 Path libraryDir = topLibrary.directoryPath;
184 RegExp relativeImportRegExp = new RegExp( 184 RegExp relativeImportRegExp = new RegExp(
185 '^(?:@.*\\s+)?' // Allow for a meta-data annotation. 185 '^(?:@.*\\s+)?' // Allow for a meta-data annotation.
186 '(import|part)' 186 '(import|part)'
187 '\\s+["\']' 187 '\\s+["\']'
188 '(?!(dart:|dart-ext:|package:|/))' // Look-ahead: not in package. 188 '(?!(dart:|dart-ext:|data:|package:|/))' // Look-ahead: not in package.
189 '([^"\']*)' // The path to the imported file. 189 '([^"\']*)' // The path to the imported file.
190 '["\']'); 190 '["\']');
191 while (!toSearch.isEmpty) { 191 while (!toSearch.isEmpty) {
192 var thisPass = toSearch; 192 var thisPass = toSearch;
193 toSearch = new Set<Path>(); 193 toSearch = new Set<Path>();
194 for (Path filename in thisPass) { 194 for (Path filename in thisPass) {
195 File f = new File(filename.toNativePath()); 195 File f = new File(filename.toNativePath());
196 for (String line in f.readAsLinesSync()) { 196 for (String line in f.readAsLinesSync()) {
197 Match match = relativeImportRegExp.firstMatch(line); 197 Match match = relativeImportRegExp.firstMatch(line);
198 if (match != null) { 198 if (match != null) {
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 // TestSuite.forDirectory. 298 // TestSuite.forDirectory.
299 split.removeLast(); 299 split.removeLast();
300 } 300 }
301 String path = '${generatedTestDir.path}/${split.last}'; 301 String path = '${generatedTestDir.path}/${split.last}';
302 Directory dir = new Directory(path); 302 Directory dir = new Directory(path);
303 if (!dir.existsSync()) { 303 if (!dir.existsSync()) {
304 dir.createSync(); 304 dir.createSync();
305 } 305 }
306 return new Path(new File(path).absolute.path); 306 return new Path(new File(path).absolute.path);
307 } 307 }
OLDNEW
« no previous file with comments | « runtime/tests/vm/dart/data_uri_spawn_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698