Chromium Code Reviews| Index: pkg/analyzer/test/generated/hint_code_test.dart |
| diff --git a/pkg/analyzer/test/generated/hint_code_test.dart b/pkg/analyzer/test/generated/hint_code_test.dart |
| index e5563a5bc16ff82d5738e9290d20ceb0b47e44e8..45df174039655f036f7073ce2a0e5e82b07e13eb 100644 |
| --- a/pkg/analyzer/test/generated/hint_code_test.dart |
| +++ b/pkg/analyzer/test/generated/hint_code_test.dart |
| @@ -6,6 +6,7 @@ library analyzer.test.generated.hint_code_test; |
| import 'package:analyzer/src/generated/engine.dart'; |
| import 'package:analyzer/src/generated/error.dart'; |
| +import 'package:analyzer/src/generated/parser.dart'; |
| import 'package:analyzer/src/generated/source_io.dart'; |
| import 'package:unittest/unittest.dart'; |
| @@ -21,54 +22,6 @@ main() { |
| @reflectiveTest |
| class HintCodeTest extends ResolverTestCase { |
| - void fail_isInt() { |
| - Source source = addSource("var v = 1 is int;"); |
| - computeLibrarySourceErrors(source); |
| - assertErrors(source, [HintCode.IS_INT]); |
| - verify([source]); |
| - } |
| - |
| - void fail_isNotInt() { |
| - Source source = addSource("var v = 1 is! int;"); |
| - computeLibrarySourceErrors(source); |
| - assertErrors(source, [HintCode.IS_NOT_INT]); |
| - verify([source]); |
| - } |
| - |
| - void fail_overrideEqualsButNotHashCode() { |
| - Source source = addSource(r''' |
| -class A { |
| - bool operator ==(x) {} |
| -}'''); |
| - computeLibrarySourceErrors(source); |
| - assertErrors(source, [HintCode.OVERRIDE_EQUALS_BUT_NOT_HASH_CODE]); |
| - verify([source]); |
| - } |
| - |
| - void fail_unusedImport_as_equalPrefixes() { |
| - // See todo at ImportsVerifier.prefixElementMap. |
| - Source source = addSource(r''' |
| -library L; |
| -import 'lib1.dart' as one; |
| -import 'lib2.dart' as one; |
| -one.A a;'''); |
| - Source source2 = addNamedSource( |
| - "/lib1.dart", |
| - r''' |
| -library lib1; |
| -class A {}'''); |
| - Source source3 = addNamedSource( |
| - "/lib2.dart", |
| - r''' |
| -library lib2; |
| -class B {}'''); |
| - computeLibrarySourceErrors(source); |
| - assertErrors(source, [HintCode.UNUSED_IMPORT]); |
| - assertNoErrors(source2); |
| - assertNoErrors(source3); |
| - verify([source, source2, source3]); |
| - } |
| - |
| @override |
| void reset() { |
| analysisContext2 = AnalysisContextFactory.contextWithCoreAndPackages({ |
| @@ -1726,6 +1679,14 @@ main() { |
| verify([source]); |
| } |
| + @failingTest |
| + void test_isInt() { |
| + Source source = addSource("var v = 1 is int;"); |
| + computeLibrarySourceErrors(source); |
| + assertErrors(source, [HintCode.IS_INT]); |
| + verify([source]); |
| + } |
| + |
| void test_isNotDouble() { |
| AnalysisOptionsImpl options = new AnalysisOptionsImpl(); |
| options.dart2jsHint = true; |
| @@ -1736,6 +1697,14 @@ main() { |
| verify([source]); |
| } |
| + @failingTest |
| + void test_isNotInt() { |
| + Source source = addSource("var v = 1 is! int;"); |
| + computeLibrarySourceErrors(source); |
| + assertErrors(source, [HintCode.IS_NOT_INT]); |
| + verify([source]); |
| + } |
| + |
| void test_js_lib_OK() { |
| Source source = addSource(r''' |
| @JS() |
| @@ -1751,7 +1720,7 @@ class A { } |
| verify([source]); |
| } |
| - void test_missing_js_lib_on_class_decl() { |
| + void test_missingJsLibAnnotation_class() { |
| Source source = addSource(r''' |
| library foo; |
| @@ -1765,7 +1734,20 @@ class A { } |
| verify([source]); |
| } |
| - void test_missing_js_lib_on_function() { |
| + void test_missingJsLibAnnotation_externalField() { |
| + // https://github.com/dart-lang/sdk/issues/26987 |
| + Source source = addSource(r''' |
| +import 'package:js/js.dart'; |
| + |
| +@JS() |
| +external dynamic exports; |
| +'''); |
| + computeLibrarySourceErrors(source); |
| + assertErrors(source, [ParserErrorCode.EXTERNAL_FIELD]); |
| + verify([source]); |
| + } |
| + |
| + void test_missingJsLibAnnotation_function() { |
| Source source = addSource(r''' |
| library foo; |
| @@ -1779,7 +1761,7 @@ set _currentZIndex(int value) { } |
| verify([source]); |
| } |
| - void test_missing_js_lib_on_member() { |
| + void test_missingJsLibAnnotation_method() { |
| Source source = addSource(r''' |
| library foo; |
| @@ -1795,6 +1777,19 @@ class A { |
| verify([source]); |
| } |
| + @failingTest |
| + void test_missingJsLibAnnotation_variable() { |
|
Brian Wilkerson
2016/07/29 17:09:06
Should this test pass, or is the test invalid?
pquitslund
2016/07/29 18:05:25
Hmmmm. It seems to me like it *should* pass.
Brian Wilkerson
2016/07/29 18:56:22
Ok, it passes now.
|
| + Source source = addSource(r''' |
| +import 'package:js/js.dart'; |
| + |
| +@JS() |
| +dynamic variable; |
| +'''); |
| + computeLibrarySourceErrors(source); |
| + assertErrors(source, [HintCode.MISSING_JS_LIB_ANNOTATION]); |
| + verify([source]); |
| + } |
| + |
| void test_missingReturn_async() { |
| Source source = addSource(''' |
| import 'dart:async'; |
| @@ -2047,6 +2042,17 @@ m(x) { |
| verify([source]); |
| } |
| + @failingTest |
| + void test_overrideEqualsButNotHashCode() { |
| + Source source = addSource(r''' |
| +class A { |
| + bool operator ==(x) {} |
| +}'''); |
| + computeLibrarySourceErrors(source); |
| + assertErrors(source, [HintCode.OVERRIDE_EQUALS_BUT_NOT_HASH_CODE]); |
| + verify([source]); |
| + } |
| + |
| void test_overrideOnNonOverridingField_invalid() { |
| Source source = addSource(r''' |
| library dart.core; |
| @@ -3511,6 +3517,31 @@ class A {}'''); |
| verify([source, source2]); |
| } |
| + @failingTest |
| + void test_unusedImport_as_equalPrefixes() { |
| + // See todo at ImportsVerifier.prefixElementMap. |
| + Source source = addSource(r''' |
| +library L; |
| +import 'lib1.dart' as one; |
| +import 'lib2.dart' as one; |
| +one.A a;'''); |
| + Source source2 = addNamedSource( |
| + "/lib1.dart", |
| + r''' |
| +library lib1; |
| +class A {}'''); |
| + Source source3 = addNamedSource( |
| + "/lib2.dart", |
| + r''' |
| +library lib2; |
| +class B {}'''); |
| + computeLibrarySourceErrors(source); |
| + assertErrors(source, [HintCode.UNUSED_IMPORT]); |
| + assertNoErrors(source2); |
| + assertNoErrors(source3); |
| + verify([source, source2, source3]); |
| + } |
| + |
| void test_unusedImport_hide() { |
| Source source = addSource(r''' |
| library L; |