OLD | NEW |
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'; | 7 import 'dart:async'; |
8 import 'dart:uri'; | 8 import 'dart:uri'; |
9 | 9 |
10 import '../../../sdk/lib/_internal/compiler/compiler.dart'; | 10 import '../../../sdk/lib/_internal/compiler/compiler.dart'; |
11 import '../../utils/dummy_compiler_test.dart' as dummy; | 11 import '../../utils/dummy_compiler_test.dart' as dummy; |
12 | 12 |
13 main() { | 13 main() { |
14 StringBuffer messages = new StringBuffer(); | 14 StringBuffer messages = new StringBuffer(); |
15 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) { |
16 if (kind == Diagnostic.VERBOSE_INFO) return; | 16 if (kind == Diagnostic.VERBOSE_INFO) return; |
17 if (identical(kind.name, 'source map')) return; | 17 if (identical(kind.name, 'source map')) return; |
18 if (uri == null) { | 18 if (uri == null) { |
19 messages.add('$kind: $message\n'); | 19 messages.write('$kind: $message\n'); |
20 } else { | 20 } else { |
21 Expect.equals('main:${uri.path}', '$uri'); | 21 Expect.equals('main:${uri.path}', '$uri'); |
22 String source = TEST_SOURCE[uri.path]; | 22 String source = TEST_SOURCE[uri.path]; |
23 Expect.isNotNull(source); | 23 Expect.isNotNull(source); |
24 messages.add('$begin<${source.substring(begin, end)}>:${uri.path}:' | 24 messages.write('$begin<${source.substring(begin, end)}>:${uri.path}:' |
25 '$kind: $message\n'); | 25 '$kind: $message\n'); |
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 Completer<String>()..complete(source)).future; | 33 return (new Completer<String>()..complete(source)).future; |
34 } | 34 } |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 main() { | 100 main() { |
101 var a = Foo.bar(); | 101 var a = Foo.bar(); |
102 var b = new Foo.bar(); | 102 var b = new Foo.bar(); |
103 new Fisk(); | 103 new Fisk(); |
104 new Fisk.hest(); | 104 new Fisk.hest(); |
105 } | 105 } |
106 """, | 106 """, |
107 // TODO(ahe): Why isn't this 'part.dart'? Why the leading slash? | 107 // TODO(ahe): Why isn't this 'part.dart'? Why the leading slash? |
108 '/part.dart': '', | 108 '/part.dart': '', |
109 }; | 109 }; |
OLD | NEW |