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

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

Issue 925943002: Refactor SourceFile, SourceFileProvider and SourceLocation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments. Created 5 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 | Annotate | Revision Log
« no previous file with comments | « tests/compiler/dart2js/type_checker_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) 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/filenames.dart'; 13 import 'package:compiler/src/filenames.dart';
14 import 'package:compiler/src/io/source_file.dart'; 14 import 'package:compiler/src/io/source_file.dart';
15 import 'package:compiler/src/source_file_provider.dart'; 15 import 'package:compiler/src/source_file_provider.dart';
16 import 'package:compiler/src/util/uri_extras.dart'; 16 import 'package:compiler/src/util/uri_extras.dart';
17 import 'dart:convert'; 17 import 'dart:convert';
18 18
19 void checkWarnings(Map<String, dynamic> tests, [List<String> arguments]) { 19 void checkWarnings(Map<String, dynamic> tests, [List<String> arguments]) {
20 bool isWindows = Platform.isWindows; 20 bool isWindows = Platform.isWindows;
21 Uri script = currentDirectory.resolveUri(Platform.script); 21 Uri script = currentDirectory.resolveUri(Platform.script);
22 bool warningsMismatch = false; 22 bool warningsMismatch = false;
23 bool verbose = arguments != null && arguments.contains('-v'); 23 bool verbose = arguments != null && arguments.contains('-v');
24 asyncTest(() => Future.forEach(tests.keys, (String test) { 24 asyncTest(() => Future.forEach(tests.keys, (String test) {
25 Uri uri = script.resolve('../../$test'); 25 Uri uri = script.resolve('../../$test');
26 String source = UTF8.decode(readAll(uriPathToNative(uri.path))); 26 String source = UTF8.decode(readAll(uriPathToNative(uri.path)));
27 SourceFile file = new StringSourceFile( 27 SourceFile file = new StringSourceFile(
28 relativize(currentDirectory, uri, isWindows), source); 28 uri, relativize(currentDirectory, uri, isWindows), source);
29 Map<int,String> expectedWarnings = {}; 29 Map<int,String> expectedWarnings = {};
30 int lineNo = 0; 30 int lineNo = 0;
31 for (String line in source.split('\n')) { 31 for (String line in source.split('\n')) {
32 if (line.contains('///') && 32 if (line.contains('///') &&
33 (line.contains('static type warning') || 33 (line.contains('static type warning') ||
34 line.contains('static warning'))) { 34 line.contains('static warning'))) {
35 expectedWarnings[lineNo] = line; 35 expectedWarnings[lineNo] = line;
36 } 36 }
37 lineNo++; 37 lineNo++;
38 } 38 }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 print('$uri [${lineNo+1}]: Missing static type warning.'); 74 print('$uri [${lineNo+1}]: Missing static type warning.');
75 print(line); 75 print(line);
76 } 76 }
77 } 77 }
78 } 78 }
79 }); 79 });
80 }).then((_) { 80 }).then((_) {
81 Expect.isFalse(warningsMismatch); 81 Expect.isFalse(warningsMismatch);
82 })); 82 }));
83 } 83 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/type_checker_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698