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

Side by Side Diff: tests/utils/recursive_import_test.dart

Issue 368983003: Add better error reporting to utils tests. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 5 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/utils/dummy_compiler_test.dart ('k') | tests/utils/source_mirrors_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) 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 // Test of "recursive" imports using the dart2js compiler API. 5 // Test of "recursive" imports using the dart2js compiler API.
6 6
7 import "package:expect/expect.dart"; 7 import "package:expect/expect.dart";
8 import "package:async_helper/async_helper.dart"; 8 import "package:async_helper/async_helper.dart";
9 import 'dart:async'; 9 import 'dart:async';
10 import 'dummy_compiler_test.dart'; 10 import 'dummy_compiler_test.dart';
(...skipping 21 matching lines...) Expand all
32 } else { 32 } else {
33 return new Future.error("unexpected URI $uri"); 33 return new Future.error("unexpected URI $uri");
34 } 34 }
35 return new Future.value(source); 35 return new Future.value(source);
36 } 36 }
37 37
38 int warningCount = 0; 38 int warningCount = 0;
39 int errorCount = 0; 39 int errorCount = 0;
40 void handler(Uri uri, int begin, int end, String message, Diagnostic kind) { 40 void handler(Uri uri, int begin, int end, String message, Diagnostic kind) {
41 if (uri != null) { 41 if (uri != null) {
42 // print('$uri:$begin:$end: $kind: $message'); 42 print('$uri:$begin:$end: $kind: $message');
43 Expect.equals('main', uri.scheme); 43 Expect.equals('main', uri.scheme);
44 if (kind == Diagnostic.WARNING) { 44 if (kind == Diagnostic.WARNING) {
45 warningCount++; 45 warningCount++;
46 } else if (kind == Diagnostic.ERROR) { 46 } else if (kind == Diagnostic.ERROR) {
47 errorCount++; 47 errorCount++;
48 } else { 48 } else {
49 throw kind; 49 throw kind;
50 } 50 }
51 } else {
52 print('$kind: $message');
51 } 53 }
52 } 54 }
53 55
54 asyncStart(); 56 asyncStart();
55 Future<String> result = 57 Future<String> result =
56 compile(new Uri(scheme: 'main'), 58 compile(new Uri(scheme: 'main'),
57 new Uri(scheme: 'lib', path: '/'), 59 new Uri(scheme: 'lib', path: '/'),
58 new Uri(scheme: 'package', path: '/'), 60 new Uri(scheme: 'package', path: '/'),
59 provider, handler); 61 provider, handler);
60 result.then((String code) { 62 result.then((String code) {
61 Expect.isNull(code); 63 Expect.isNull(code);
62 Expect.isTrue(10 < count); 64 Expect.isTrue(10 < count);
63 // Two warnings for each time RECURSIVE_MAIN is read, except the 65 // Two warnings for each time RECURSIVE_MAIN is read, except the
64 // first time. 66 // first time.
65 Expect.equals(2 * (count - 1), warningCount); 67 Expect.equals(2 * (count - 1), warningCount);
66 Expect.equals(1, errorCount); 68 Expect.equals(1, errorCount);
67 }, onError: (e) { 69 }, onError: (e, s) {
68 throw 'Compilation failed'; 70 throw 'Compilation failed: $e\n$s';
69 }).then(asyncSuccess); 71 }).then(asyncSuccess);
70 } 72 }
OLDNEW
« no previous file with comments | « tests/utils/dummy_compiler_test.dart ('k') | tests/utils/source_mirrors_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698