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

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

Issue 17759007: First pass at asynchronous input loading in dart2js. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Remove withCurrentElementAsync Created 7 years, 4 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 "package:expect/expect.dart"; 7 import "package:expect/expect.dart";
8 import 'dart:async'; 8 import 'dart:async';
9 9
10 import '../../../sdk/lib/_internal/compiler/compiler.dart'; 10 import '../../../sdk/lib/_internal/compiler/compiler.dart';
(...skipping 15 matching lines...) Expand all
26 } 26 }
27 } 27 }
28 28
29 Future<String> provider(Uri uri) { 29 Future<String> provider(Uri uri) {
30 if (uri.scheme != "main") return dummy.provider(uri); 30 if (uri.scheme != "main") return dummy.provider(uri);
31 String source = TEST_SOURCE[uri.path]; 31 String source = TEST_SOURCE[uri.path];
32 Expect.isNotNull(source); 32 Expect.isNotNull(source);
33 return new Future<String>.value(source); 33 return new Future<String>.value(source);
34 } 34 }
35 35
36 String code = deprecatedFutureValue( 36 compile(new Uri(scheme: 'main'),
37 compile(new Uri(scheme: 'main'), 37 new Uri(scheme: 'lib', path: '/'),
38 new Uri(scheme: 'lib', path: '/'), 38 new Uri(scheme: 'package', path: '/'),
39 new Uri(scheme: 'package', path: '/'), 39 provider, handler).then((code) {
40 provider, handler)); 40 if (code == null) {
41 if (code == null) { 41 throw 'Compilation failed: ${messages}';
42 throw 'Compilation failed: ${messages}'; 42 }
43 } 43 Expect.stringEquals(
44 Expect.stringEquals( 44 // This string is composed of lines of the following format:
45 // This string is composed of lines of the following format: 45 //
46 // 46 // offset<source>:path:kind: message
47 // offset<source>:path:kind: message 47 //
48 // 48 // "offset" is the character offset from the beginning of TEST_SOURCE.
49 // "offset" is the character offset from the beginning of TEST_SOURCE. 49 // "source" is the substring of TEST_SOURCE that the compiler is
50 // "source" is the substring of TEST_SOURCE that the compiler is 50 // indicating as erroneous.
51 // indicating as erroneous. 51 // "path" is the URI path.
52 // "path" is the URI path. 52 // "kind" is the result of calling toString on a [Diagnostic] object.
53 // "kind" is the result of calling toString on a [Diagnostic] object. 53 // "message" is the expected message as a [String]. This is a
54 // "message" is the expected message as a [String]. This is a 54 // short-term solution and should eventually changed to include
55 // short-term solution and should eventually changed to include 55 // a symbolic reference to a MessageKind.
56 // a symbolic reference to a MessageKind. 56 "15<part 'part.dart';>::${deprecatedMessage('missing part-of tag')}\n"
57 "15<part 'part.dart';>::${deprecatedMessage('missing part-of tag')}\n" 57 "0<>:/part.dart:info: Note: This file has no part-of tag, but it is"
58 "0<>:/part.dart:info: Note: This file has no part-of tag, but it is being" 58 " being used as a part.\n"
59 " used as a part.\n" 59 "53<()>::${deprecatedMessage('getter parameters')}\n",
60 "53<()>::${deprecatedMessage('getter parameters')}\n", 60 messages.toString());
61 messages.toString()); 61 });
62 } 62 }
63 63
64 deprecatedMessage(feature) { 64 deprecatedMessage(feature) {
65 return 65 return
66 "warning: Warning: Deprecated language feature, $feature" 66 "warning: Warning: Deprecated language feature, $feature"
67 ", will be removed in a future Dart milestone."; 67 ", will be removed in a future Dart milestone.";
68 } 68 }
69 69
70 const Map<String, String> TEST_SOURCE = 70 const Map<String, String> TEST_SOURCE =
71 const <String, String>{ '': """ 71 const <String, String>{ '': """
72 library test; 72 library test;
73 73
74 part 'part.dart'; 74 part 'part.dart';
75 75
76 class Foo { 76 class Foo {
77 get x() => null; 77 get x() => null;
78 } 78 }
79 79
80 main() { 80 main() {
81 var a = new Foo(); 81 var a = new Foo();
82 } 82 }
83 """, 83 """,
84 // TODO(ahe): Why isn't this 'part.dart'? Why the leading slash? 84 // TODO(ahe): Why isn't this 'part.dart'? Why the leading slash?
85 '/part.dart': '', 85 '/part.dart': '',
86 }; 86 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698