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

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

Issue 11358045: Update test utils to generate wrappers with new library syntax and handle (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 1 month 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 | « tools/testing/dart/browser_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 /** 5 /**
6 * Classes and methods for enumerating and preparing tests. 6 * Classes and methods for enumerating and preparing tests.
7 * 7 *
8 * This library includes: 8 * This library includes:
9 * 9 *
10 * - Creating tests by listing all the Dart files in certain directories, 10 * - Creating tests by listing all the Dart files in certain directories,
(...skipping 959 matching lines...) Expand 10 before | Expand all | Expand 10 after
970 RegExp otherScriptsRegExp = const RegExp(r"// OtherScripts=(.*)"); 970 RegExp otherScriptsRegExp = const RegExp(r"// OtherScripts=(.*)");
971 RegExp multiTestRegExp = const RegExp(r"/// [0-9][0-9]:(.*)"); 971 RegExp multiTestRegExp = const RegExp(r"/// [0-9][0-9]:(.*)");
972 RegExp staticTypeRegExp = 972 RegExp staticTypeRegExp =
973 const RegExp(r"/// ([0-9][0-9]:){0,1}\s*static type warning"); 973 const RegExp(r"/// ([0-9][0-9]:){0,1}\s*static type warning");
974 RegExp compileTimeRegExp = 974 RegExp compileTimeRegExp =
975 const RegExp(r"/// ([0-9][0-9]:){0,1}\s*compile-time error"); 975 const RegExp(r"/// ([0-9][0-9]:){0,1}\s*compile-time error");
976 RegExp staticCleanRegExp = const RegExp(r"// @static-clean"); 976 RegExp staticCleanRegExp = const RegExp(r"// @static-clean");
977 RegExp leadingHashRegExp = const RegExp(r"^#", multiLine: true); 977 RegExp leadingHashRegExp = const RegExp(r"^#", multiLine: true);
978 RegExp isolateStubsRegExp = const RegExp(r"// IsolateStubs=(.*)"); 978 RegExp isolateStubsRegExp = const RegExp(r"// IsolateStubs=(.*)");
979 RegExp domImportRegExp = 979 RegExp domImportRegExp =
980 const RegExp(r"^#import.*(dart:(dom|html)|html\.dart).*\)", 980 const RegExp(r"^[#]?import.*dart:html", multiLine: true);
981 multiLine: true);
982 RegExp libraryDefinitionRegExp = 981 RegExp libraryDefinitionRegExp =
983 const RegExp(r"^#library\(", multiLine: true); 982 const RegExp(r"^[#]?library[\( ]", multiLine: true);
984 RegExp sourceOrImportRegExp = 983 RegExp sourceOrImportRegExp =
985 const RegExp(r"^#(source|import|resource)\(", multiLine: true); 984 const RegExp(r"^[#]?(source|part|import|resource)", multiLine: true);
Siggi Cherem (dart-lang) 2012/11/01 21:02:04 I think resource is gone. Also this matches more t
ahe 2012/11/01 21:08:42 I don't think it matters. There are good chances w
gram 2012/11/01 21:20:48 Yes, these false positives are very unlikely to ha
985 RegExp partofRegExp =
986 const RegExp(r"^[ \t]*part[ \t]*of[ \t]", multiLine: true);
986 987
987 // Read the entire file into a byte buffer and transform it to a 988 // Read the entire file into a byte buffer and transform it to a
988 // String. This will treat the file as ascii but the only parts 989 // String. This will treat the file as ascii but the only parts
989 // we are interested in will be ascii in any case. 990 // we are interested in will be ascii in any case.
990 RandomAccessFile file = new File.fromPath(filePath).openSync(FileMode.READ); 991 RandomAccessFile file = new File.fromPath(filePath).openSync(FileMode.READ);
991 List chars = new List(file.lengthSync()); 992 List chars = new List(file.lengthSync());
992 var offset = 0; 993 var offset = 0;
993 while (offset != chars.length) { 994 while (offset != chars.length) {
994 offset += file.readListSync(chars, offset, chars.length - offset); 995 offset += file.readListSync(chars, offset, chars.length - offset);
995 } 996 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
1033 for (var match in matches) { 1034 for (var match in matches) {
1034 otherScripts.addAll(match[1].split(' ').filter((e) => e != '')); 1035 otherScripts.addAll(match[1].split(' ').filter((e) => e != ''));
1035 } 1036 }
1036 1037
1037 bool isMultitest = multiTestRegExp.hasMatch(contents); 1038 bool isMultitest = multiTestRegExp.hasMatch(contents);
1038 bool containsLeadingHash = leadingHashRegExp.hasMatch(contents); 1039 bool containsLeadingHash = leadingHashRegExp.hasMatch(contents);
1039 Match isolateMatch = isolateStubsRegExp.firstMatch(contents); 1040 Match isolateMatch = isolateStubsRegExp.firstMatch(contents);
1040 String isolateStubs = isolateMatch != null ? isolateMatch[1] : ''; 1041 String isolateStubs = isolateMatch != null ? isolateMatch[1] : '';
1041 bool containsDomImport = domImportRegExp.hasMatch(contents); 1042 bool containsDomImport = domImportRegExp.hasMatch(contents);
1042 bool isLibraryDefinition = libraryDefinitionRegExp.hasMatch(contents); 1043 bool isLibraryDefinition = libraryDefinitionRegExp.hasMatch(contents);
1043 bool containsSourceOrImport = sourceOrImportRegExp.hasMatch(contents); 1044 bool containsSourceOrImport = sourceOrImportRegExp.hasMatch(contents) &&
1045 !partofRegExp.hasMatch(contents);
Siggi Cherem (dart-lang) 2012/11/01 21:02:04 alternative you could include a ['"] in the match
1044 int numStaticTypeAnnotations = 0; 1046 int numStaticTypeAnnotations = 0;
1045 for (var i in staticTypeRegExp.allMatches(contents)) { 1047 for (var i in staticTypeRegExp.allMatches(contents)) {
1046 numStaticTypeAnnotations++; 1048 numStaticTypeAnnotations++;
1047 } 1049 }
1048 int numCompileTimeAnnotations = 0; 1050 int numCompileTimeAnnotations = 0;
1049 for (var i in compileTimeRegExp.allMatches(contents)) { 1051 for (var i in compileTimeRegExp.allMatches(contents)) {
1050 numCompileTimeAnnotations++; 1052 numCompileTimeAnnotations++;
1051 } 1053 }
1052 1054
1053 return { "vmOptions": result, 1055 return { "vmOptions": result,
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
1486 * $noCrash tests are expected to be flaky but not crash 1488 * $noCrash tests are expected to be flaky but not crash
1487 * $pass tests are expected to pass 1489 * $pass tests are expected to pass
1488 * $failOk tests are expected to fail that we won't fix 1490 * $failOk tests are expected to fail that we won't fix
1489 * $fail tests are expected to fail that we should fix 1491 * $fail tests are expected to fail that we should fix
1490 * $crash tests are expected to crash that we should fix 1492 * $crash tests are expected to crash that we should fix
1491 * $timeout tests are allowed to timeout 1493 * $timeout tests are allowed to timeout
1492 """; 1494 """;
1493 print(report); 1495 print(report);
1494 } 1496 }
1495 } 1497 }
OLDNEW
« no previous file with comments | « tools/testing/dart/browser_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698