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

Unified Diff: pkg/analysis_server/test/services/completion/completion_target_test.dart

Issue 999923002: completions for function return type (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merge Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: pkg/analysis_server/test/services/completion/completion_target_test.dart
diff --git a/pkg/analysis_server/test/services/completion/completion_target_test.dart b/pkg/analysis_server/test/services/completion/completion_target_test.dart
index 426352c581d80e0695d32f9f52acca8efc719f07..e416cb40310b9101aa5417c024e5cf56980d4a7e 100644
--- a/pkg/analysis_server/test/services/completion/completion_target_test.dart
+++ b/pkg/analysis_server/test/services/completion/completion_target_test.dart
@@ -137,6 +137,151 @@ class CompletionTargetTest extends AbstractContextTest {
assertTarget('}', '{}');
}
+ test_FunctionDeclaration_inLineComment() {
+ // Comment CompilationUnit
+ addTestSource('''
+ // normal comment ^
+ zoo(z) { } String name;''');
+ assertTarget('// normal comment ', 'zoo(z) {} String name;');
+ }
+
+ test_FunctionDeclaration_inLineComment2() {
+ // Comment CompilationUnit
+ addTestSource('''
+ // normal ^comment
+ zoo(z) { } String name;''');
+ assertTarget('// normal comment', 'zoo(z) {} String name;');
+ }
+
+ test_FunctionDeclaration_inLineComment3() {
+ // Comment CompilationUnit
+ addTestSource('''
+ // normal comment ^
+ // normal comment 2
+ zoo(z) { } String name;''');
+ assertTarget('// normal comment ', 'zoo(z) {} String name;');
+ }
+
+ test_FunctionDeclaration_inLineComment4() {
+ // Comment CompilationUnit
+ addTestSource('''
+ // normal comment
+ // normal comment 2^
+ zoo(z) { } String name;''');
+ assertTarget('// normal comment 2', 'zoo(z) {} String name;');
+ }
+
+ test_FunctionDeclaration_inLineDocComment() {
+ // Comment FunctionDeclaration CompilationUnit
+ addTestSource('''
+ /// some dartdoc ^
+ zoo(z) { } String name;''');
+ assertTarget('/// some dartdoc ', '');
+ expect(target.containingNode is Comment, isTrue);
+ expect(target.containingNode.parent.toSource(), 'zoo(z) {}');
+ }
+
+ test_FunctionDeclaration_inLineDocComment2() {
+ // Comment FunctionDeclaration CompilationUnit
+ addTestSource('''
+ /// some ^dartdoc
+ zoo(z) { } String name;''');
+ assertTarget('/// some dartdoc', '');
+ expect(target.containingNode is Comment, isTrue);
+ expect(target.containingNode.parent.toSource(), 'zoo(z) {}');
+ }
+
+ test_FunctionDeclaration_inStarComment() {
+ // Comment CompilationUnit
+ addTestSource('/* ^ */ zoo(z) {} String name;');
+ assertTarget('/* */', 'zoo(z) {} String name;');
+ }
+
+ test_FunctionDeclaration_inStarComment2() {
+ // Comment CompilationUnit
+ addTestSource('/* *^/ zoo(z) {} String name;');
+ assertTarget('/* */', 'zoo(z) {} String name;');
+ }
+
+ test_FunctionDeclaration_inStarDocComment() {
+ // Comment FunctionDeclaration CompilationUnit
+ addTestSource('/** ^ */ zoo(z) { } String name;');
+ assertTarget('/** */', '');
+ expect(target.containingNode is Comment, isTrue);
+ expect(target.containingNode.parent.toSource(), 'zoo(z) {}');
+ }
+
+ test_FunctionDeclaration_inStarDocComment2() {
+ // Comment FunctionDeclaration CompilationUnit
+ addTestSource('/** *^/ zoo(z) { } String name;');
+ assertTarget('/** */', '');
+ expect(target.containingNode is Comment, isTrue);
+ expect(target.containingNode.parent.toSource(), 'zoo(z) {}');
+ }
+
+ test_FunctionDeclaration_returnType() {
+ // CompilationUnit
+ addTestSource('^ zoo(z) { } String name;');
+ assertTarget('zoo(z) {}', 'zoo(z) {} String name;');
+ }
+
+ test_FunctionDeclaration_returnType_afterLineComment() {
+ // FunctionDeclaration CompilationUnit
+ addTestSource('''
+ // normal comment
+ ^ zoo(z) {} String name;''');
+ assertTarget('zoo(z) {}', 'zoo(z) {} String name;');
+ }
+
+ test_FunctionDeclaration_returnType_afterLineComment2() {
+ // FunctionDeclaration CompilationUnit
+ // TOD(danrubel) left align all test source
+ addTestSource('''
+// normal comment
+^ zoo(z) {} String name;''');
+ assertTarget('zoo(z) {}', 'zoo(z) {} String name;');
+ }
+
+ test_FunctionDeclaration_returnType_afterLineDocComment() {
+ // SimpleIdentifier FunctionDeclaration CompilationUnit
+ addTestSource('''
+ /// some dartdoc
+ ^ zoo(z) { } String name; ''');
+ assertTarget('zoo', 'zoo(z) {}');
+ }
+
+ test_FunctionDeclaration_returnType_afterLineDocComment2() {
+ // SimpleIdentifier FunctionDeclaration CompilationUnit
+ addTestSource('''
+/// some dartdoc
+^ zoo(z) { } String name;''');
+ assertTarget('zoo', 'zoo(z) {}');
+ }
+
+ test_FunctionDeclaration_returnType_afterStarComment() {
+ // CompilationUnit
+ addTestSource('/* */ ^ zoo(z) { } String name;');
+ assertTarget('zoo(z) {}', 'zoo(z) {} String name;');
+ }
+
+ test_FunctionDeclaration_returnType_afterStarComment2() {
+ // CompilationUnit
+ addTestSource('/* */^ zoo(z) { } String name;');
+ assertTarget('zoo(z) {}', 'zoo(z) {} String name;');
+ }
+
+ test_FunctionDeclaration_returnType_afterStarDocComment() {
+ // FunctionDeclaration CompilationUnit
+ addTestSource('/** */ ^ zoo(z) { } String name;');
+ assertTarget('zoo', 'zoo(z) {}');
+ }
+
+ test_FunctionDeclaration_returnType_afterStarDocComment2() {
+ // FunctionDeclaration CompilationUnit
+ addTestSource('/** */^ zoo(z) { } String name;');
+ assertTarget('zoo', 'zoo(z) {}');
+ }
+
test_InstanceCreationExpression_identifier() {
// InstanceCreationExpression ExpressionStatement Block
addTestSource('class C {foo(){var f; {var x;} new ^C();}}');

Powered by Google App Engine
This is Rietveld 408576698