More CFE tests for server
Change-Id: I829032909ce3c9244c8b204ca12b8aeef61e997e
Reviewed-on: https://dart-review.googlesource.com/68844
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
diff --git a/pkg/analysis_server/test/plugin/protocol_dart_test.dart b/pkg/analysis_server/test/plugin/protocol_dart_test.dart
index 0a46a17..f1fe58f 100644
--- a/pkg/analysis_server/test/plugin/protocol_dart_test.dart
+++ b/pkg/analysis_server/test/plugin/protocol_dart_test.dart
@@ -22,6 +22,7 @@
main() {
defineReflectiveSuite(() {
defineReflectiveTests(ElementTest);
+ defineReflectiveTests(ElementTest_UseCFE);
defineReflectiveTests(ElementKindTest);
});
}
@@ -511,3 +512,21 @@
expect(element.flags, 0);
}
}
+
+@reflectiveTest
+class ElementTest_UseCFE extends ElementTest {
+ @override
+ bool get useCFE => true;
+
+ @failingTest
+ @override
+ test_fromElement_ENUM() => super.test_fromElement_ENUM();
+
+ @failingTest
+ @override
+ test_fromElement_ENUM_CONSTANT() => super.test_fromElement_ENUM_CONSTANT();
+
+ @failingTest
+ @override
+ test_fromElement_LABEL() => super.test_fromElement_LABEL();
+}
diff --git a/pkg/analysis_server/test/src/computer/closingLabels_computer_test.dart b/pkg/analysis_server/test/src/computer/closingLabels_computer_test.dart
index 1c5ec8d..2c9e9dd 100644
--- a/pkg/analysis_server/test/src/computer/closingLabels_computer_test.dart
+++ b/pkg/analysis_server/test/src/computer/closingLabels_computer_test.dart
@@ -15,6 +15,7 @@
main() {
defineReflectiveSuite(() {
defineReflectiveTests(ClosingLabelsComputerTest);
+ defineReflectiveTests(ClosingLabelsComputerTest_UseCFE);
});
}
@@ -406,3 +407,13 @@
return computer.compute();
}
}
+
+@reflectiveTest
+class ClosingLabelsComputerTest_UseCFE extends ClosingLabelsComputerTest {
+ @override
+ bool get useCFE => true;
+
+ @failingTest
+ @override
+ test_knownBadCode1() => super.test_knownBadCode1();
+}
diff --git a/pkg/analysis_server/test/src/computer/folding_computer_test.dart b/pkg/analysis_server/test/src/computer/folding_computer_test.dart
index c301f7f..abf0480 100644
--- a/pkg/analysis_server/test/src/computer/folding_computer_test.dart
+++ b/pkg/analysis_server/test/src/computer/folding_computer_test.dart
@@ -15,6 +15,7 @@
main() {
defineReflectiveSuite(() {
defineReflectiveTests(FoldingComputerTest);
+ defineReflectiveTests(FoldingComputerTest_UseCFE);
});
}
@@ -27,237 +28,6 @@
sourcePath = resourceProvider.convertPath('/p/lib/source.dart');
}
- test_single_import_directives() async {
- String content = """
-import 'dart:async';
-
-main() {}
-""";
-
- // Since there are no region comment markers above
- // just check the length instead of the contents
- final regions = await _computeRegions(content);
- expect(regions, hasLength(0));
- }
-
- test_multiple_import_directives() async {
- String content = """
-import/*1:INC*/ 'dart:async';
-
-// We can have comments
-import 'package:a/b.dart';
-import 'package:b/c.dart';
-
-import '../a.dart';/*1:EXC:DIRECTIVES*/
-
-main() {}
-""";
-
- final regions = await _computeRegions(content);
- _compareRegions(regions, content);
- }
-
- test_multiple_directive_types() async {
- String content = """
-import/*1:INC*/ 'dart:async';
-
-// We can have comments
-import 'package:a/b.dart';
-import 'package:b/c.dart';
-
-export '../a.dart';/*1:EXC:DIRECTIVES*/
-
-main() {}
-""";
-
- final regions = await _computeRegions(content);
- _compareRegions(regions, content);
- }
-
- test_function() async {
- String content = """
-// Content before
-
-main() {/*1:INC*/
- print("Hello, world!");
-/*1:INC:FUNCTION_BODY*/}
-
-// Content after
-""";
-
- final regions = await _computeRegions(content);
- _compareRegions(regions, content);
- }
-
- test_function_with_dart_doc() async {
- String content = """
-// Content before
-
-/*1:EXC*//// This is a doc comment
-/// that spans lines/*1:INC:DOCUMENTATION_COMMENT*/
-main() {/*2:INC*/
- print("Hello, world!");
-/*2:INC:FUNCTION_BODY*/}
-
-// Content after
-""";
-
- final regions = await _computeRegions(content);
- _compareRegions(regions, content);
- }
-
- test_invocations() async {
- String content = """
-// Content before
-
-main() {/*1:INC*/
- print(/*2:INC*/
- "Hello, world!",
- /*2:INC:INVOCATION*/);
-/*1:INC:FUNCTION_BODY*/}
-
-// Content after
-""";
-
- final regions = await _computeRegions(content);
- _compareRegions(regions, content);
- }
-
- test_function_expression_invocation() async {
- String content = """
-// Content before
-
-getFunc() => (String a, String b) {/*1:INC*/
- print(a);
-/*1:INC:FUNCTION_BODY*/};
-
-main2() {/*2:INC*/
- getFunc()(/*3:INC*/
- "one",
- "two"
- /*3:INC:INVOCATION*/);
-/*2:INC:FUNCTION_BODY*/}
-
-// Content after
-""";
-
- final regions = await _computeRegions(content);
- _compareRegions(regions, content);
- }
-
- test_constructor_invocations() async {
- String content = """
-// Content before
-
-main() {/*1:INC*/
- return new Text(/*2:INC*/
- "Hello, world!",
- /*2:INC:INVOCATION*/);
-/*1:INC:FUNCTION_BODY*/}
-
-// Content after
-""";
-
- final regions = await _computeRegions(content);
- _compareRegions(regions, content);
- }
-
- test_nested_invocations() async {
- String content = """
-// Content before
-
-main() {/*1:INC*/
- a(/*2:INC*/
- b(/*3:INC*/
- c(/*4:INC*/
- d()
- /*4:INC:INVOCATION*/),
- /*3:INC:INVOCATION*/),
- /*2:INC:INVOCATION*/);
-/*1:INC:FUNCTION_BODY*/}
-
-// Content after
-""";
-
- final regions = await _computeRegions(content);
- _compareRegions(regions, content);
- }
-
- test_literal_list() async {
- String content = """
-// Content before
-
-main() {/*1:INC*/
- final List<String> things = <String>[/*2:INC*/
- "one",
- "two"
- /*2:INC:LITERAL*/];
-/*1:INC:FUNCTION_BODY*/}
-
-// Content after
-""";
-
- final regions = await _computeRegions(content);
- _compareRegions(regions, content);
- }
-
- test_literal_map() async {
- String content = """
-// Content before
-
-main2() {/*1:INC*/
- final Map<String, String> things = <String, String>{/*2:INC*/
- "one": "one",
- "two": "two"
- /*2:INC:LITERAL*/};
-/*1:INC:FUNCTION_BODY*/}
-
-// Content after
-""";
-
- final regions = await _computeRegions(content);
- _compareRegions(regions, content);
- }
-
- test_nested_function() async {
- String content = """
-// Content before
-
-main() {/*1:INC*/
- doPrint() {/*2:INC*/
- print("Hello, world!");
- /*2:INC:FUNCTION_BODY*/}
- doPrint();
-/*1:INC:FUNCTION_BODY*/}
-
-// Content after
-""";
-
- final regions = await _computeRegions(content);
- _compareRegions(regions, content);
- }
-
- test_class() async {
- String content = """
-// Content before
-
-class Person {/*1:INC*/
- Person() {/*2:INC*/
- print("Hello, world!");
- /*2:INC:FUNCTION_BODY*/}
-
- void sayHello() {/*3:INC*/
- print("Hello, world!");
- /*3:INC:FUNCTION_BODY*/}
-/*1:INC:CLASS_BODY*/}
-
-// Content after
-""";
-
- final regions = await _computeRegions(content);
- _compareRegions(regions, content);
- }
-
test_annotations() async {
String content = """
@myMultilineAnnotation/*1:INC*/(
@@ -309,6 +79,57 @@
_compareRegions(regions, content);
}
+ test_class() async {
+ String content = """
+// Content before
+
+class Person {/*1:INC*/
+ Person() {/*2:INC*/
+ print("Hello, world!");
+ /*2:INC:FUNCTION_BODY*/}
+
+ void sayHello() {/*3:INC*/
+ print("Hello, world!");
+ /*3:INC:FUNCTION_BODY*/}
+/*1:INC:CLASS_BODY*/}
+
+// Content after
+""";
+
+ final regions = await _computeRegions(content);
+ _compareRegions(regions, content);
+ }
+
+ test_comment_is_not_considered_file_header() async {
+ String content = """
+// This is not the file header
+// It's just a comment
+main() {}
+""";
+
+ // Since there are no region comment markers above
+ // just check the length instead of the contents
+ final regions = await _computeRegions(content);
+ expect(regions, hasLength(0));
+ }
+
+ test_constructor_invocations() async {
+ String content = """
+// Content before
+
+main() {/*1:INC*/
+ return new Text(/*2:INC*/
+ "Hello, world!",
+ /*2:INC:INVOCATION*/);
+/*1:INC:FUNCTION_BODY*/}
+
+// Content after
+""";
+
+ final regions = await _computeRegions(content);
+ _compareRegions(regions, content);
+ }
+
test_file_header() async {
String content = """
// Copyright some year by some people/*1:EXC*/
@@ -323,6 +144,21 @@
_compareRegions(regions, content);
}
+ test_file_header_does_not_include_block_comments() async {
+ String content = """
+/*
+ * Copyright some year by some people
+ * See LICENCE etc.
+ */
+/* This shouldn't be part of the file header */
+
+main() {}
+""";
+
+ final regions = await _computeRegions(content);
+ expect(regions, hasLength(0));
+ }
+
test_file_header_with_no_function_comment() async {
String content = """
// Copyright some year by some people/*1:EXC*/
@@ -348,21 +184,6 @@
_compareRegions(regions, content);
}
- test_file_header_does_not_include_block_comments() async {
- String content = """
-/*
- * Copyright some year by some people
- * See LICENCE etc.
- */
-/* This shouldn't be part of the file header */
-
-main() {}
-""";
-
- final regions = await _computeRegions(content);
- expect(regions, hasLength(0));
- }
-
test_file_header_with_script_prefix() async {
String content = """
#! /usr/bin/dart
@@ -378,10 +199,190 @@
_compareRegions(regions, content);
}
- test_comment_is_not_considered_file_header() async {
+ test_function() async {
String content = """
-// This is not the file header
-// It's just a comment
+// Content before
+
+main() {/*1:INC*/
+ print("Hello, world!");
+/*1:INC:FUNCTION_BODY*/}
+
+// Content after
+""";
+
+ final regions = await _computeRegions(content);
+ _compareRegions(regions, content);
+ }
+
+ test_function_expression_invocation() async {
+ String content = """
+// Content before
+
+getFunc() => (String a, String b) {/*1:INC*/
+ print(a);
+/*1:INC:FUNCTION_BODY*/};
+
+main2() {/*2:INC*/
+ getFunc()(/*3:INC*/
+ "one",
+ "two"
+ /*3:INC:INVOCATION*/);
+/*2:INC:FUNCTION_BODY*/}
+
+// Content after
+""";
+
+ final regions = await _computeRegions(content);
+ _compareRegions(regions, content);
+ }
+
+ test_function_with_dart_doc() async {
+ String content = """
+// Content before
+
+/*1:EXC*//// This is a doc comment
+/// that spans lines/*1:INC:DOCUMENTATION_COMMENT*/
+main() {/*2:INC*/
+ print("Hello, world!");
+/*2:INC:FUNCTION_BODY*/}
+
+// Content after
+""";
+
+ final regions = await _computeRegions(content);
+ _compareRegions(regions, content);
+ }
+
+ test_invocations() async {
+ String content = """
+// Content before
+
+main() {/*1:INC*/
+ print(/*2:INC*/
+ "Hello, world!",
+ /*2:INC:INVOCATION*/);
+/*1:INC:FUNCTION_BODY*/}
+
+// Content after
+""";
+
+ final regions = await _computeRegions(content);
+ _compareRegions(regions, content);
+ }
+
+ test_literal_list() async {
+ String content = """
+// Content before
+
+main() {/*1:INC*/
+ final List<String> things = <String>[/*2:INC*/
+ "one",
+ "two"
+ /*2:INC:LITERAL*/];
+/*1:INC:FUNCTION_BODY*/}
+
+// Content after
+""";
+
+ final regions = await _computeRegions(content);
+ _compareRegions(regions, content);
+ }
+
+ test_literal_map() async {
+ String content = """
+// Content before
+
+main2() {/*1:INC*/
+ final Map<String, String> things = <String, String>{/*2:INC*/
+ "one": "one",
+ "two": "two"
+ /*2:INC:LITERAL*/};
+/*1:INC:FUNCTION_BODY*/}
+
+// Content after
+""";
+
+ final regions = await _computeRegions(content);
+ _compareRegions(regions, content);
+ }
+
+ test_multiple_directive_types() async {
+ String content = """
+import/*1:INC*/ 'dart:async';
+
+// We can have comments
+import 'package:a/b.dart';
+import 'package:b/c.dart';
+
+export '../a.dart';/*1:EXC:DIRECTIVES*/
+
+main() {}
+""";
+
+ final regions = await _computeRegions(content);
+ _compareRegions(regions, content);
+ }
+
+ test_multiple_import_directives() async {
+ String content = """
+import/*1:INC*/ 'dart:async';
+
+// We can have comments
+import 'package:a/b.dart';
+import 'package:b/c.dart';
+
+import '../a.dart';/*1:EXC:DIRECTIVES*/
+
+main() {}
+""";
+
+ final regions = await _computeRegions(content);
+ _compareRegions(regions, content);
+ }
+
+ test_nested_function() async {
+ String content = """
+// Content before
+
+main() {/*1:INC*/
+ doPrint() {/*2:INC*/
+ print("Hello, world!");
+ /*2:INC:FUNCTION_BODY*/}
+ doPrint();
+/*1:INC:FUNCTION_BODY*/}
+
+// Content after
+""";
+
+ final regions = await _computeRegions(content);
+ _compareRegions(regions, content);
+ }
+
+ test_nested_invocations() async {
+ String content = """
+// Content before
+
+main() {/*1:INC*/
+ a(/*2:INC*/
+ b(/*3:INC*/
+ c(/*4:INC*/
+ d()
+ /*4:INC:INVOCATION*/),
+ /*3:INC:INVOCATION*/),
+ /*2:INC:INVOCATION*/);
+/*1:INC:FUNCTION_BODY*/}
+
+// Content after
+""";
+
+ final regions = await _computeRegions(content);
+ _compareRegions(regions, content);
+ }
+
+ test_single_import_directives() async {
+ String content = """
+import 'dart:async';
+
main() {}
""";
@@ -438,3 +439,21 @@
return computer.compute();
}
}
+
+@reflectiveTest
+class FoldingComputerTest_UseCFE extends FoldingComputerTest {
+ @override
+ bool get useCFE => true;
+
+ @failingTest
+ @override
+ test_annotations() => super.test_annotations();
+
+ @failingTest
+ @override
+ test_multiple_directive_types() => super.test_multiple_directive_types();
+
+ @failingTest
+ @override
+ test_multiple_import_directives() => super.test_multiple_import_directives();
+}
diff --git a/pkg/analysis_server/test/src/computer/import_elements_computer_test.dart b/pkg/analysis_server/test/src/computer/import_elements_computer_test.dart
index 7be302a..939f15b 100644
--- a/pkg/analysis_server/test/src/computer/import_elements_computer_test.dart
+++ b/pkg/analysis_server/test/src/computer/import_elements_computer_test.dart
@@ -17,6 +17,7 @@
main() {
defineReflectiveSuite(() {
defineReflectiveTests(ImportElementsComputerTest);
+ defineReflectiveTests(ImportElementsComputerTest_UseCFE);
});
}
@@ -358,3 +359,13 @@
''');
}
}
+
+@reflectiveTest
+class ImportElementsComputerTest_UseCFE extends ImportElementsComputerTest {
+ @override
+ bool get useCFE => true;
+
+ @failingTest
+ @override
+ test_createEdits_invalidUri() => super.test_createEdits_invalidUri();
+}
diff --git a/pkg/analysis_server/test/src/computer/imported_elements_computer_test.dart b/pkg/analysis_server/test/src/computer/imported_elements_computer_test.dart
index 55c106b..574c073 100644
--- a/pkg/analysis_server/test/src/computer/imported_elements_computer_test.dart
+++ b/pkg/analysis_server/test/src/computer/imported_elements_computer_test.dart
@@ -15,6 +15,7 @@
main() {
defineReflectiveSuite(() {
defineReflectiveTests(ImportElementsComputerTest);
+ defineReflectiveTests(ImportElementsComputerTest_UseCFE);
});
}
@@ -398,3 +399,9 @@
return computer.compute();
}
}
+
+@reflectiveTest
+class ImportElementsComputerTest_UseCFE extends ImportElementsComputerTest {
+ @override
+ bool get useCFE => true;
+}
diff --git a/pkg/analysis_server/test/src/computer/outline_computer_test.dart b/pkg/analysis_server/test/src/computer/outline_computer_test.dart
index 9aa971d..dcd2eba 100644
--- a/pkg/analysis_server/test/src/computer/outline_computer_test.dart
+++ b/pkg/analysis_server/test/src/computer/outline_computer_test.dart
@@ -16,7 +16,9 @@
main() {
defineReflectiveSuite(() {
defineReflectiveTests(FlutterOutlineComputerTest);
+ defineReflectiveTests(FlutterOutlineComputerTest_UseCFE);
defineReflectiveTests(OutlineComputerTest);
+ defineReflectiveTests(OutlineComputerTest_UseCFE);
});
}
@@ -138,6 +140,12 @@
}
@reflectiveTest
+class FlutterOutlineComputerTest_UseCFE extends FlutterOutlineComputerTest {
+ @override
+ bool get useCFE => true;
+}
+
+@reflectiveTest
class OutlineComputerTest extends AbstractOutlineComputerTest {
test_class() async {
Outline unitOutline = await _computeOutline('''
@@ -1152,3 +1160,9 @@
expect(element.returnType, isNull);
}
}
+
+@reflectiveTest
+class OutlineComputerTest_UseCFE extends OutlineComputerTest {
+ @override
+ bool get useCFE => true;
+}
diff --git a/pkg/analysis_server/test/src/domains/execution/completion_test.dart b/pkg/analysis_server/test/src/domains/execution/completion_test.dart
index 4ba0ecd..263c8b8 100644
--- a/pkg/analysis_server/test/src/domains/execution/completion_test.dart
+++ b/pkg/analysis_server/test/src/domains/execution/completion_test.dart
@@ -14,6 +14,7 @@
main() {
defineReflectiveSuite(() {
defineReflectiveTests(RuntimeCompletionComputerTest);
+ defineReflectiveTests(RuntimeCompletionComputerTest_UseCFE);
});
}
@@ -377,3 +378,19 @@
assertSuggested('b', returnType: 'double');
}
}
+
+@reflectiveTest
+class RuntimeCompletionComputerTest_UseCFE
+ extends RuntimeCompletionComputerTest {
+ @override
+ bool get useCFE => true;
+
+ @failingTest
+ @override
+ test_parameters_function_nested() => super.test_parameters_function_nested();
+
+ @failingTest
+ @override
+ test_parameters_functionExpression() =>
+ super.test_parameters_functionExpression();
+}
diff --git a/pkg/analysis_server/test/src/flutter/flutter_outline_computer_test.dart b/pkg/analysis_server/test/src/flutter/flutter_outline_computer_test.dart
index e4b62c4..01ec170 100644
--- a/pkg/analysis_server/test/src/flutter/flutter_outline_computer_test.dart
+++ b/pkg/analysis_server/test/src/flutter/flutter_outline_computer_test.dart
@@ -15,6 +15,7 @@
main() {
defineReflectiveSuite(() {
defineReflectiveTests(FlutterOutlineComputerTest);
+ defineReflectiveTests(FlutterOutlineComputerTest_UseCFE);
});
}
@@ -698,3 +699,62 @@
return buffer.toString();
}
}
+
+@reflectiveTest
+class FlutterOutlineComputerTest_UseCFE extends FlutterOutlineComputerTest {
+ @override
+ bool get useCFE => true;
+
+ @failingTest
+ @override
+ test_attribute_namedExpression() => super.test_attribute_namedExpression();
+
+ @failingTest
+ @override
+ test_attributes_bool() => super.test_attributes_bool();
+
+ @failingTest
+ @override
+ test_attributes_functionExpression_hasParameters_blockExpression() =>
+ super.test_attributes_functionExpression_hasParameters_blockExpression();
+
+ @failingTest
+ @override
+ test_attributes_functionExpression_hasParameters_bodyExpression() =>
+ super.test_attributes_functionExpression_hasParameters_bodyExpression();
+
+ @failingTest
+ @override
+ test_attributes_functionExpression_noParameters_blockExpression() =>
+ super.test_attributes_functionExpression_noParameters_blockExpression();
+
+ @failingTest
+ @override
+ test_attributes_functionExpression_noParameters_bodyExpression() =>
+ super.test_attributes_functionExpression_noParameters_bodyExpression();
+
+ @failingTest
+ @override
+ test_attributes_int() => super.test_attributes_int();
+
+ @failingTest
+ @override
+ test_attributes_listLiteral() => super.test_attributes_listLiteral();
+
+ @failingTest
+ @override
+ test_attributes_mapLiteral() => super.test_attributes_mapLiteral();
+
+ @failingTest
+ @override
+ test_attributes_multiLine() => super.test_attributes_multiLine();
+
+ @failingTest
+ @override
+ test_attributes_string_interpolation() =>
+ super.test_attributes_string_interpolation();
+
+ @failingTest
+ @override
+ test_attributes_string_literal() => super.test_attributes_string_literal();
+}