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

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

Issue 11788016: Update dart2js unit tests to new library API. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: No need to implement Iterable Created 7 years, 11 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
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 that deprecated language features are diagnosed correctly. 5 // Test that deprecated language features are diagnosed correctly.
6 6
7 import 'dart:async';
8 import 'dart:uri';
9
7 import '../../../sdk/lib/_internal/compiler/compiler.dart'; 10 import '../../../sdk/lib/_internal/compiler/compiler.dart';
8 import 'dart:uri';
9 import '../../utils/dummy_compiler_test.dart' as dummy; 11 import '../../utils/dummy_compiler_test.dart' as dummy;
10 12
11 main() { 13 main() {
12 StringBuffer messages = new StringBuffer(); 14 StringBuffer messages = new StringBuffer();
13 void handler(Uri uri, int begin, int end, String message, Diagnostic kind) { 15 void handler(Uri uri, int begin, int end, String message, Diagnostic kind) {
14 if (kind == Diagnostic.VERBOSE_INFO) return; 16 if (kind == Diagnostic.VERBOSE_INFO) return;
15 if (identical(kind.name, 'source map')) return; 17 if (identical(kind.name, 'source map')) return;
16 if (uri == null) { 18 if (uri == null) {
17 messages.add('$kind: $message\n'); 19 messages.add('$kind: $message\n');
18 } else { 20 } else {
19 Expect.equals('main:${uri.path}', '$uri'); 21 Expect.equals('main:${uri.path}', '$uri');
20 String source = TEST_SOURCE[uri.path]; 22 String source = TEST_SOURCE[uri.path];
21 Expect.isNotNull(source); 23 Expect.isNotNull(source);
22 messages.add('$begin<${source.substring(begin, end)}>:${uri.path}:' 24 messages.add('$begin<${source.substring(begin, end)}>:${uri.path}:'
23 '$kind: $message\n'); 25 '$kind: $message\n');
24 } 26 }
25 } 27 }
26 28
27 Future<String> provider(Uri uri) { 29 Future<String> provider(Uri uri) {
28 if (uri.scheme != "main") return dummy.provider(uri); 30 if (uri.scheme != "main") return dummy.provider(uri);
29 String source = TEST_SOURCE[uri.path]; 31 String source = TEST_SOURCE[uri.path];
30 Expect.isNotNull(source); 32 Expect.isNotNull(source);
31 return (new Completer<String>()..complete(source)).future; 33 return (new Completer<String>()..complete(source)).future;
32 } 34 }
33 35
34 String code = compile(new Uri.fromComponents(scheme: 'main'), 36 String code = deprecatedFutureValue(
35 new Uri.fromComponents(scheme: 'lib', path: '/'), 37 compile(new Uri.fromComponents(scheme: 'main'),
36 new Uri.fromComponents(scheme: 'package', path: '/'), 38 new Uri.fromComponents(scheme: 'lib', path: '/'),
37 provider, handler).value; 39 new Uri.fromComponents(scheme: 'package', path: '/'),
40 provider, handler));
38 if (code == null) { 41 if (code == null) {
39 throw 'Compilation failed: ${messages}'; 42 throw 'Compilation failed: ${messages}';
40 } 43 }
41 Expect.stringEquals( 44 Expect.stringEquals(
42 // This string is comprised of lines of the following format: 45 // This string is comprised of lines of the following format:
43 // 46 //
44 // offset<source>:path:kind: message 47 // offset<source>:path:kind: message
45 // 48 //
46 // "offset" is the character offset from the beginning of TEST_SOURCE. 49 // "offset" is the character offset from the beginning of TEST_SOURCE.
47 // "source" is the substring of TEST_SOURCE that the compiler is 50 // "source" is the substring of TEST_SOURCE that the compiler is
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 main() { 102 main() {
100 var a = Foo.bar(); 103 var a = Foo.bar();
101 var b = new Foo.bar(); 104 var b = new Foo.bar();
102 new Fisk(); 105 new Fisk();
103 new Fisk.hest(); 106 new Fisk.hest();
104 } 107 }
105 """, 108 """,
106 // TODO(ahe): Why isn't this 'part.dart'? Why the leading slash? 109 // TODO(ahe): Why isn't this 'part.dart'? Why the leading slash?
107 '/part.dart': '', 110 '/part.dart': '',
108 }; 111 };
OLDNEW
« no previous file with comments | « dart/tests/compiler/dart2js/dart_backend_test.dart ('k') | dart/tests/compiler/dart2js/for_in_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698