OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 we don't report invalid modifier on error tokens. | 5 // Test that we don't report invalid modifier on error tokens. |
6 | 6 |
7 library dart2js.test.error_token; | 7 library dart2js.test.error_token; |
8 | 8 |
9 import 'dart:async'; | 9 import 'dart:async'; |
10 import 'package:async_helper/async_helper.dart'; | 10 import 'package:async_helper/async_helper.dart'; |
(...skipping 14 matching lines...) Expand all Loading... |
25 Expect.equals(error != null ? 1 : 0, diagnostics.errors.length); | 25 Expect.equals(error != null ? 1 : 0, diagnostics.errors.length); |
26 if (error != null) | 26 if (error != null) |
27 Expect.equals(error, diagnostics.errors.first.message.kind); | 27 Expect.equals(error, diagnostics.errors.first.message.kind); |
28 Expect.equals(expectedWarningCount, diagnostics.warnings.length); | 28 Expect.equals(expectedWarningCount, diagnostics.warnings.length); |
29 Expect.equals(0, diagnostics.hints.length); | 29 Expect.equals(0, diagnostics.hints.length); |
30 Expect.equals(0, diagnostics.infos.length); | 30 Expect.equals(0, diagnostics.infos.length); |
31 } | 31 } |
32 | 32 |
33 void main() { | 33 void main() { |
34 asyncTest(() async { | 34 asyncTest(() async { |
35 await runTest( | 35 await runTest(''' |
36 ''' | |
37 main() {Foo.bar();} | 36 main() {Foo.bar();} |
38 class Foo { | 37 class Foo { |
39 static void bar() { | 38 static void bar() { |
40 baz()); | 39 baz()); |
41 } | 40 } |
42 } | 41 } |
43 ''', | 42 ''', error: MessageKind.MISSING_TOKEN_AFTER_THIS, expectedWarningCount: 1); |
44 error: MessageKind.MISSING_TOKEN_AFTER_THIS, | |
45 expectedWarningCount: 1); | |
46 | 43 |
47 await runTest( | 44 await runTest(''' |
48 ''' | |
49 main() {new C(v);} | 45 main() {new C(v);} |
50 class C { | 46 class C { |
51 C(v) { | 47 C(v) { |
52 throw ''); | 48 throw ''); |
53 } | 49 } |
54 }''', | 50 }''', error: MessageKind.MISSING_TOKEN_AFTER_THIS, expectedWarningCount: 1); |
55 error: MessageKind.MISSING_TOKEN_AFTER_THIS, | |
56 expectedWarningCount: 1); | |
57 }); | 51 }); |
58 } | 52 } |
OLD | NEW |