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

Side by Side Diff: tests/compiler/dart2js/warnings_checker.dart

Issue 2765893003: Fix warnings_checker.dart handling of multitests (Closed)
Patch Set: Created 3 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 | « pkg/testing/lib/src/multitest.dart ('k') | tests/compiler/dart2js_extra/23486_test.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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 // Test that dart2js produces the expected static type warnings to ensures that 5 // Test that dart2js produces the expected static type warnings to ensures that
6 // the analyzer and dart2js agrees on the tests. 6 // the analyzer and dart2js agrees on the tests.
7 7
8 import 'dart:async'; 8 import 'dart:async';
9 import 'dart:io'; 9 import 'dart:io';
10 import 'package:expect/expect.dart'; 10 import 'package:expect/expect.dart';
11 import 'package:async_helper/async_helper.dart'; 11 import 'package:async_helper/async_helper.dart';
12 import 'memory_compiler.dart'; 12 import 'memory_compiler.dart';
13 import 'package:compiler/src/commandline_options.dart'; 13 import 'package:compiler/src/commandline_options.dart';
14 import 'package:compiler/src/filenames.dart'; 14 import 'package:compiler/src/filenames.dart';
15 import 'package:compiler/src/io/source_file.dart'; 15 import 'package:compiler/src/io/source_file.dart';
16 import 'package:compiler/src/source_file_provider.dart'; 16 import 'package:compiler/src/source_file_provider.dart';
17 import 'package:compiler/src/util/uri_extras.dart'; 17 import 'package:compiler/src/util/uri_extras.dart';
18 import 'dart:convert'; 18 import 'dart:convert';
19 19
20 final _multiTestRegExpSeperator = new RegExp(r"//[#/]");
21
20 void checkWarnings(Map<String, dynamic> tests, [List<String> arguments]) { 22 void checkWarnings(Map<String, dynamic> tests, [List<String> arguments]) {
21 bool isWindows = Platform.isWindows; 23 bool isWindows = Platform.isWindows;
22 Uri script = currentDirectory.resolveUri(Platform.script); 24 Uri script = currentDirectory.resolveUri(Platform.script);
23 bool warningsMismatch = false; 25 bool warningsMismatch = false;
24 bool verbose = arguments != null && arguments.contains('-v'); 26 bool verbose = arguments != null && arguments.contains('-v');
25 asyncTest(() => Future.forEach(tests.keys, (String test) async { 27 asyncTest(() => Future.forEach(tests.keys, (String test) async {
26 Uri uri = script.resolve('../../$test'); 28 Uri uri = script.resolve('../../$test');
27 String source = UTF8.decode(readAll(uriPathToNative(uri.path))); 29 String source = UTF8.decode(readAll(uriPathToNative(uri.path)));
28 SourceFile file = new StringSourceFile( 30 SourceFile file = new StringSourceFile(
29 uri, relativize(currentDirectory, uri, isWindows), source); 31 uri, relativize(currentDirectory, uri, isWindows), source);
30 Map<int, String> expectedWarnings = {}; 32 Map<int, String> expectedWarnings = {};
31 int lineNo = 0; 33 int lineNo = 0;
32 for (String line in source.split('\n')) { 34 for (String line in source.split('\n')) {
33 if (line.contains('///') && 35 if (line.contains(_multiTestRegExpSeperator) &&
34 (line.contains('static type warning') || 36 (line.contains('static type warning') ||
35 line.contains('static warning'))) { 37 line.contains('static warning'))) {
36 expectedWarnings[lineNo] = line; 38 expectedWarnings[lineNo] = line;
37 } 39 }
38 lineNo++; 40 lineNo++;
39 } 41 }
40 Set<int> unseenWarnings = new Set<int>.from(expectedWarnings.keys); 42 Set<int> unseenWarnings = new Set<int>.from(expectedWarnings.keys);
41 DiagnosticCollector collector = new DiagnosticCollector(); 43 DiagnosticCollector collector = new DiagnosticCollector();
42 await runCompiler( 44 await runCompiler(
43 entryPoint: uri, 45 entryPoint: uri,
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 String line = expectedWarnings[lineNo]; 77 String line = expectedWarnings[lineNo];
76 print('$uri [${lineNo+1}]: Missing static type warning.'); 78 print('$uri [${lineNo+1}]: Missing static type warning.');
77 print(line); 79 print(line);
78 } 80 }
79 } 81 }
80 } 82 }
81 }).then((_) { 83 }).then((_) {
82 Expect.isFalse(warningsMismatch); 84 Expect.isFalse(warningsMismatch);
83 })); 85 }));
84 } 86 }
OLDNEW
« no previous file with comments | « pkg/testing/lib/src/multitest.dart ('k') | tests/compiler/dart2js_extra/23486_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698