blob: 92dd886aa5bd2a6a7399cd74fa6ed3221c9bcc6d [file] [log] [blame]
// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../../../client/completion_driver_test.dart';
// TODO(brianwilkerson): The contents of this file were generated from an older
// style of tests. They need to be cleaned up (many contain test code that
// isn't used in the test), renamed, and moved into the appropriate 'location'
// or 'declaration' test class.
void main() {
defineReflectiveSuite(() {
defineReflectiveTests(ConvertedTest);
});
}
@reflectiveTest
class ConvertedTest extends AbstractCompletionDriverTest
with ConvertedTestCases {}
mixin ConvertedTestCases on AbstractCompletionDriverTest {
Future<void> test_001_1() async {
allowedIdentifiers = {'toString', '=='};
await computeSuggestions('''
void r1(var v) {
v.^toString().hashCode
}
''');
assertResponse(r'''
replacement
right: 8
suggestions
toString
kind: methodInvocation
''');
}
Future<void> test_001_2() async {
allowedIdentifiers = {'toString'};
await computeSuggestions('''
void r1(var v) {
v.toString^().hashCode
}
''');
assertResponse(r'''
replacement
left: 8
suggestions
toString
kind: methodInvocation
''');
}
Future<void> test_001_3() async {
allowedIdentifiers = {'hashCode', 'toString'};
await computeSuggestions('''
void r1(var v) {
v.toString().^hashCode
}
''');
assertResponse(r'''
replacement
right: 8
suggestions
hashCode
kind: getter
toString
kind: methodInvocation
''');
}
Future<void> test_001_4() async {
allowedIdentifiers = {'hashCode', 'toString'};
await computeSuggestions('''
void r1(var v) {
v.toString().hash^Code
}
''');
assertResponse(r'''
replacement
left: 4
right: 4
suggestions
hashCode
kind: getter
''');
}
Future<void> test_002_1() async {
allowedIdentifiers = {'vim'};
await computeSuggestions('''
void r2(var vim) {
v^.toString()
}
''');
assertResponse(r'''
replacement
left: 1
suggestions
vim
kind: parameter
var
kind: keyword
void
kind: keyword
''');
}
Future<void> test_003_1() async {
allowedIdentifiers = {'a'};
await computeSuggestions('''
class A {
int a() => 3;
int b() => this.^a();
}
''');
assertResponse(r'''
replacement
right: 1
suggestions
a
kind: methodInvocation
''');
}
@failingTest
Future<void> test_004_1() async {
allowedIdentifiers = {'x'};
await computeSuggestions('''
class A {
int x;
A() : this.^x = 1;
A.b() : this();
A.c() : this.b();
g() => new A.c();
}
''');
assertResponse(r'''
replacement
right: 1
suggestions
assert
kind: keyword
x
kind: localVariable
''');
}
@failingTest
Future<void> test_004_2() async {
allowedIdentifiers = {'b'};
await computeSuggestions('''
class A {
int x;
A() : this.x = 1;
A.b() : this();
A.c() : this.^b();
g() => new A.c();
}
''');
assertResponse(r'''
replacement
right: 1
suggestions
assert
kind: keyword
b
kind: constructorInvocation
''');
}
Future<void> test_004_3() async {
allowedIdentifiers = {'c'};
await computeSuggestions('''
class A {
int x;
A() : this.x = 1;
A.b() : this();
A.c() : this.b();
g() => new A.^c();
}
''');
assertResponse(r'''
replacement
right: 1
suggestions
c
kind: constructorInvocation
''');
}
Future<void> test_005_1() async {
allowedIdentifiers = {
'vq',
'A',
'vim',
'vf',
'this',
'void',
'null',
'false'
};
await computeSuggestions('''
class A {}
void rr(var vim) {
var ^vq = v.toString();
var vf;
v.toString();
}
''');
assertResponse(r'''
replacement
right: 2
suggestions
''');
}
Future<void> test_005_2() async {
allowedIdentifiers = {
'vim',
'A',
'vf',
'vq',
'this',
'void',
'null',
'false'
};
await computeSuggestions('''
class A {}
void rr(var vim) {
var vq = v^.toString();
var vf;
v.toString();
}
''');
assertResponse(r'''
replacement
left: 1
suggestions
vim
kind: parameter
''');
}
Future<void> test_005_3() async {
allowedIdentifiers = {'vf', 'vq', 'vim', 'A'};
await computeSuggestions('''
class A {}
void rr(var vim) {
var vq = v.toString();
var vf;
v^.toString();
}
''');
assertResponse(r'''
replacement
left: 1
suggestions
vf
kind: localVariable
vq
kind: localVariable
vim
kind: parameter
var
kind: keyword
void
kind: keyword
''');
}
Future<void> test_006_1() async {
allowedIdentifiers = {'va', 'b'};
await computeSuggestions('''
void r2(var vim, {va: 2, b: 3}) {
v^.toString()
}
''');
assertResponse(r'''
replacement
left: 1
suggestions
va
kind: parameter
var
kind: keyword
void
kind: keyword
''');
}
Future<void> test_007_1() async {
allowedIdentifiers = {'va', 'b'};
await computeSuggestions('''
void r2(var vim, [va: 2, b: 3]) {
v^.toString()
}
''');
assertResponse(r'''
replacement
left: 1
suggestions
va
kind: parameter
var
kind: keyword
void
kind: keyword
''');
}
Future<void> test_008_1() async {
await computeSuggestions('''
^class Aclass {}
class Bclass extends Aclass {}
abstract class Eclass implements Aclass, Bclass {}
class Fclass extends Bclass with Eclass {}
''');
assertResponse(r'''
replacement
right: 5
suggestions
import '';
kind: keyword
selection: 8
export '';
kind: keyword
selection: 8
abstract
kind: keyword
base
kind: keyword
class
kind: keyword
const
kind: keyword
covariant
kind: keyword
dynamic
kind: keyword
enum
kind: keyword
extension
kind: keyword
external
kind: keyword
final
kind: keyword
interface
kind: keyword
late
kind: keyword
library
kind: keyword
mixin
kind: keyword
part '';
kind: keyword
selection: 6
part of '';
kind: keyword
selection: 9
sealed
kind: keyword
typedef
kind: keyword
var
kind: keyword
void
kind: keyword
''');
}
Future<void> test_008_2() async {
await computeSuggestions('''
class Aclass {}
class Bclass ^extends Aclass {}
abstract class Eclass implements Aclass, Bclass {}
class Fclass extends Bclass with Eclass {}
''');
assertResponse(r'''
replacement
right: 7
suggestions
extends
kind: keyword
implements
kind: keyword
with
kind: keyword
''');
}
Future<void> test_008_3() async {
await computeSuggestions('''
class Aclass {}
class Bclass extends^ Aclass {}
abstract class Eclass implements Aclass, Bclass {}
class Fclass extends Bclass with Eclass {}
''');
assertResponse(r'''
replacement
left: 7
suggestions
extends
kind: keyword
''');
}
@FailingTest(reason: 'Bclass is being suggested, but it cannot extend itself')
Future<void> test_008_4() async {
allowedIdentifiers = {'Aclass', 'Bclass'};
await computeSuggestions('''
class Aclass {}
class Bclass extends ^Aclass {}
abstract class Eclass implements Aclass, Bclass {}
class Fclass extends Bclass with Eclass {}
''');
assertResponse(r'''
replacement
right: 6
suggestions
Aclass
kind: class
''');
}
Future<void> test_008_5() async {
await computeSuggestions('''
class Aclass {}
class Bclass extends Aclass {}
^abstract class Eclass implements Aclass, Bclass {}
class Fclass extends Bclass with Eclass {}
''');
assertResponse(r'''
replacement
right: 8
suggestions
class
kind: keyword
const
kind: keyword
void
kind: keyword
final
kind: keyword
enum
kind: keyword
typedef
kind: keyword
abstract
kind: keyword
base
kind: keyword
covariant
kind: keyword
dynamic
kind: keyword
extension
kind: keyword
external
kind: keyword
interface
kind: keyword
late
kind: keyword
mixin
kind: keyword
sealed
kind: keyword
var
kind: keyword
''');
}
Future<void> test_008_6() async {
await computeSuggestions('''
class Aclass {}
class Bclass extends Aclass {}
abstract class Eclass implements Aclass, Bclass {}
class Fclass extends Bclass ^with Eclass {}
''');
assertResponse(r'''
replacement
right: 4
suggestions
implements
kind: keyword
with
kind: keyword
''');
}
Future<void> test_008_7() async {
allowedIdentifiers = {'Eclass', 'Dclass', 'Ctype'};
await computeSuggestions('''
class Aclass {}
class Bclass extends Aclass {}
abstract class Eclass implements Aclass, Bclass {}
class Fclass extends Bclass with ^ Eclass {}
''');
assertResponse(r'''
suggestions
Eclass
kind: class
''');
}
@failingTest
Future<void> test_009_1() async {
allowedIdentifiers = {'void', 'TestFn2'};
await computeSuggestions('''
typedef ^dynamic TestFn1();
typedef void TestFn2();
typedef n
''');
assertResponse(r'''
replacement
right: 7
suggestions
dynamic
kind: keyword
TestFn2
kind: typeAlias
void
kind: keyword
''');
}
@failingTest
Future<void> test_009_2() async {
allowedIdentifiers = {'dynamic', 'void'};
await computeSuggestions('''
typedef dy^namic TestFn1();
typedef void TestFn2();
typedef n
''');
assertResponse(r'''
replacement
left: 2
right: 5
suggestions
dynamic
kind: keyword
void
kind: keyword
''');
}
@failingTest
Future<void> test_009_3() async {
allowedIdentifiers = {'dynamic'};
await computeSuggestions('''
typedef dynamic TestFn1();
typedef ^void TestFn2();
typedef n
''');
assertResponse(r'''
replacement
right: 4
suggestions
dynamic
kind: keyword
void
kind: keyword
''');
}
@failingTest
Future<void> test_009_4() async {
allowedIdentifiers = {'void', 'dynamic'};
await computeSuggestions('''
typedef dynamic TestFn1();
typedef vo^id TestFn2();
typedef n
''');
assertResponse(r'''
replacement
left: 2
right: 2
suggestions
dynamic
kind: keyword
void
kind: keyword
''');
}
Future<void> test_009_5() async {
allowedIdentifiers = {'TestFn2'};
await computeSuggestions('''
typedef dynamic TestFn1();
typedef void TestFn2();
typedef ^n
''');
assertResponse(r'''
replacement
right: 1
suggestions
TestFn2
kind: typeAlias
''');
}
Future<void> test_009_6() async {
allowedIdentifiers = {'num'};
await computeSuggestions('''
typedef dynamic TestFn1();
typedef void TestFn2();
typedef n^
''');
assertResponse(r'''
replacement
left: 1
suggestions
num
kind: class
''');
}
Future<void> test_009_7() async {
await computeSuggestions('''
typedef dynamic TestFn1();
typedef void TestFn2();
typ^edef n
''');
assertResponse(r'''
replacement
left: 3
right: 4
suggestions
typedef
kind: keyword
''');
}
Future<void> test_010_1() async {
allowedIdentifiers = {'String', 'List', 'test'};
await computeSuggestions('''
class test <^t extends String, List, > {}
class tezetst <String, List> {}
''');
assertResponse(r'''
replacement
right: 1
suggestions
''');
}
@failingTest
Future<void> test_010_2() async {
allowedIdentifiers = {'String', 'test'};
await computeSuggestions('''
class test <t ^ extends String, List, > {}
class tezetst <String, List> {}
''');
assertResponse(r'''
suggestions
''');
}
Future<void> test_010_3() async {
await computeSuggestions('''
class test <t ^extends String, List, > {}
class tezetst <String, List> {}
''');
assertResponse(r'''
replacement
right: 7
suggestions
extends
kind: keyword
''');
}
Future<void> test_010_4() async {
allowedIdentifiers = {'tezetst', 'test'};
await computeSuggestions('''
class test <t extends String,^ List, > {}
class tezetst <String, List> {}
''');
assertResponse(r'''
suggestions
''');
}
Future<void> test_010_5() async {
allowedIdentifiers = {'String'};
await computeSuggestions('''
class test <t extends String, List,^ > {}
class tezetst <String, List> {}
''');
assertResponse(r'''
suggestions
''');
}
Future<void> test_010_6() async {
allowedIdentifiers = {'List'};
await computeSuggestions('''
class test <t extends String, List, ^> {}
class tezetst <String, List> {}
''');
assertResponse(r'''
suggestions
''');
}
Future<void> test_010_7() async {
allowedIdentifiers = {'List'};
await computeSuggestions('''
class test <t extends String, List, >^ {}
class tezetst <String, List> {}
''');
assertResponse(r'''
suggestions
''');
}
Future<void> test_010_8() async {
allowedIdentifiers = {'List'};
await computeSuggestions('''
class test ^<t extends String, List, > {}
class tezetst <String, List> {}
''');
assertResponse(r'''
suggestions
''');
}
Future<void> test_010_9() async {
allowedIdentifiers = {'String'};
await computeSuggestions('''
class test <t extends String, List, > {}
class tezetst ^<String, List> {}
''');
assertResponse(r'''
suggestions
''');
}
Future<void> test_010_A() async {
allowedIdentifiers = {'String'};
await computeSuggestions('''
class test <t extends String, List, > {}
class tezetst <String, List>^ {}
''');
assertResponse(r'''
suggestions
''');
}
Future<void> test_010_B() async {
allowedIdentifiers = {'String'};
await computeSuggestions('''
class test <t extends String, List, > {}
class tezetst <^String, List> {}
''');
assertResponse(r'''
replacement
right: 6
suggestions
''');
}
Future<void> test_010_C() async {
allowedIdentifiers = {'List', 'tezetst'};
await computeSuggestions('''
class test <t extends String, List, > {}
class tezetst <String,^ List> {}
''');
assertResponse(r'''
suggestions
''');
}
Future<void> test_010_D() async {
allowedIdentifiers = {'List', 'test'};
await computeSuggestions('''
class test <t extends String, List, > {}
class tezetst <String, ^List> {}
''');
assertResponse(r'''
replacement
right: 4
suggestions
''');
}
@failingTest
Future<void> test_011_1() async {
allowedIdentifiers = {'object2'};
await computeSuggestions('''
r2(var object, Object object1, Object ^);
''');
assertResponse(r'''
suggestions
covariant
kind: keyword
dynamic
kind: keyword
final
kind: keyword
object2
kind: identifier
void
kind: keyword
''');
}
@failingTest
Future<void> test_012_1() async {
allowedIdentifiers = {'var', 'dynamic', 'f'};
await computeSuggestions('''
class X {
f() {
g(^var z) {true.toString();};
}
}
''');
assertResponse(r'''
replacement
right: 3
suggestions
dynamic
kind: keyword
var
kind: keyword
''');
}
@failingTest
Future<void> test_012_2() async {
allowedIdentifiers = {'var', 'dynamic'};
await computeSuggestions('''
class X {
f() {
g(var^ z) {true.toString();};
}
}
''');
assertResponse(r'''
replacement
left: 3
suggestions
void
kind: keyword
''');
}
Future<void> test_012_3() async {
await computeSuggestions('''
class X {
f() {
g(var z) {^true.toString();};
}
}
''');
assertResponse(r'''
replacement
right: 4
suggestions
return
kind: keyword
if
kind: keyword
final
kind: keyword
var
kind: keyword
super
kind: keyword
throw
kind: keyword
for
kind: keyword
this
kind: keyword
switch
kind: keyword
try
kind: keyword
assert
kind: keyword
const
kind: keyword
do
kind: keyword
dynamic
kind: keyword
false
kind: keyword
late
kind: keyword
null
kind: keyword
true
kind: keyword
void
kind: keyword
while
kind: keyword
''');
}
Future<void> test_012_4() async {
allowedIdentifiers = {'toString'};
await computeSuggestions('''
class X {
f() {
g(var z) {true.^toString();};
}
}
''');
assertResponse(r'''
replacement
right: 8
suggestions
toString
kind: methodInvocation
''');
}
Future<void> test_013_0() async {
allowedIdentifiers = {'k'};
await computeSuggestions('''
class Q {
bool x;
List zs;
int k;
var a;
mth() {
while (x );
do{} while(x );
for(z in zs) {}
switch(k) {case 1:{^}}
try {
} on Object catch(a){}
if (x ) {} else {};
}
}
''');
assertResponse(r'''
suggestions
return
kind: keyword
k
kind: field
if
kind: keyword
final
kind: keyword
var
kind: keyword
super
kind: keyword
throw
kind: keyword
for
kind: keyword
this
kind: keyword
switch
kind: keyword
try
kind: keyword
assert
kind: keyword
break
kind: keyword
const
kind: keyword
do
kind: keyword
dynamic
kind: keyword
false
kind: keyword
late
kind: keyword
null
kind: keyword
true
kind: keyword
void
kind: keyword
while
kind: keyword
''');
}
Future<void> test_013_1() async {
allowedIdentifiers = {'x'};
await computeSuggestions('''
class Q {
bool x;
List zs;
int k;
var a;
mth() {
while (^x );
do{} while(x );
for(z in zs) {}
switch(k) {case 1:{}}
try {
} on Object catch(a){}
if (x ) {} else {};
}
}
''');
assertResponse(r'''
replacement
right: 1
suggestions
true
kind: keyword
x
kind: field
false
kind: keyword
null
kind: keyword
super
kind: keyword
switch
kind: keyword
this
kind: keyword
''');
}
Future<void> test_013_2() async {
allowedIdentifiers = {'x'};
await computeSuggestions('''
class Q {
bool x;
List zs;
int k;
var a;
mth() {
while (x );
do{} while(^x );
for(z in zs) {}
switch(k) {case 1:{}}
try {
} on Object catch(a){}
if (x ) {} else {};
}
}
''');
assertResponse(r'''
replacement
right: 1
suggestions
false
kind: keyword
true
kind: keyword
x
kind: field
null
kind: keyword
super
kind: keyword
switch
kind: keyword
this
kind: keyword
''');
}
Future<void> test_013_3() async {
allowedIdentifiers = {'zs'};
await computeSuggestions('''
class Q {
bool x;
List zs;
int k;
var a;
mth() {
while (x );
do{} while(x );
for(z in ^zs) {}
switch(k) {case 1:{}}
try {
} on Object catch(a){}
if (x ) {} else {};
}
}
''');
assertResponse(r'''
replacement
right: 2
suggestions
zs
kind: field
await
kind: keyword
''');
}
Future<void> test_013_4() async {
allowedIdentifiers = {'k'};
await computeSuggestions('''
class Q {
bool x;
List zs;
int k;
var a;
mth() {
while (x );
do{} while(x );
for(z in zs) {}
switch(^k) {case 1:{}}
try {
} on Object catch(a){}
if (x ) {} else {};
}
}
''');
assertResponse(r'''
replacement
right: 1
suggestions
k
kind: field
const
kind: keyword
false
kind: keyword
null
kind: keyword
super
kind: keyword
switch
kind: keyword
this
kind: keyword
true
kind: keyword
''');
}
Future<void> test_013_5() async {
allowedIdentifiers = {'Q', 'a'};
await computeSuggestions('''
class Q {
bool x;
List zs;
int k;
var a;
mth() {
while (x );
do{} while(x );
for(z in zs) {}
switch(k) {case 1:{}}
try {
} on ^Object catch(a){}
if (x ) {} else {};
}
}
''');
assertResponse(r'''
replacement
right: 6
suggestions
Q
kind: class
dynamic
kind: keyword
void
kind: keyword
''');
}
Future<void> test_013_6() async {
allowedIdentifiers = {'=='};
await computeSuggestions('''
class Q {
bool x;
List zs;
int k;
var a;
mth() {
while (x );
do{} while(x );
for(z in zs) {}
switch(k) {case 1:{}}
try {
} on Object catch(a){}
if (x ^) {} else {};
}
}
''');
assertResponse(r'''
suggestions
case
kind: keyword
is
kind: keyword
''');
}
Future<void> test_013_7() async {
allowedIdentifiers = {'x'};
await computeSuggestions('''
class Q {
bool x;
List zs;
int k;
var a;
mth() {
while (x );
do{} while(x );
for(z in zs) {}
switch(k) {case 1:{}}
try {
} on Object catch(a){}
if (^x ) {} else {};
}
}
''');
assertResponse(r'''
replacement
right: 1
suggestions
x
kind: field
false
kind: keyword
true
kind: keyword
null
kind: keyword
this
kind: keyword
const
kind: keyword
super
kind: keyword
switch
kind: keyword
''');
}
Future<void> test_013_8() async {
allowedIdentifiers = {'=='};
await computeSuggestions('''
class Q {
bool x;
List zs;
int k;
var a;
mth() {
while (x );
do{} while(x ^);
for(z in zs) {}
switch(k) {case 1:{}}
try {
} on Object catch(a){}
if (x ) {} else {};
}
}
''');
assertResponse(r'''
suggestions
''');
}
Future<void> test_013_9() async {
allowedIdentifiers = {'=='};
await computeSuggestions('''
class Q {
bool x;
List zs;
int k;
var a;
mth() {
while (x ^);
do{} while(x );
for(z in zs) {}
switch(k) {case 1:{}}
try {
} on Object catch(a){}
if (x ) {} else {};
}
}
''');
assertResponse(r'''
suggestions
''');
}
Future<void> test_014_1() async {
await computeSuggestions('''
class Q {
bool x;
List zs;
int k;
var a;
void mth() {
^while (z) { continue; };
do{ break; } while(x);
for(z in zs) {}
for (int i; i < 3; i++);
switch(k) {case 1:{} default:{}}
try {
} on Object catch(a){}
assert true;
if (x) {} else {};
return;
}
}
''');
assertResponse(r'''
replacement
right: 5
suggestions
return
kind: keyword
if
kind: keyword
final
kind: keyword
var
kind: keyword
super
kind: keyword
throw
kind: keyword
for
kind: keyword
this
kind: keyword
switch
kind: keyword
try
kind: keyword
assert
kind: keyword
break
kind: keyword
continue
kind: keyword
do
kind: keyword
dynamic
kind: keyword
false
kind: keyword
late
kind: keyword
null
kind: keyword
true
kind: keyword
void
kind: keyword
while
kind: keyword
''');
}
Future<void> test_014_2() async {
await computeSuggestions('''
class Q {
bool x;
List zs;
int k;
var a;
void mth() {
while (z) { continue; };
^do{ break; } while(x);
for(z in zs) {}
for (int i; i < 3; i++);
switch(k) {case 1:{} default:{}}
try {
} on Object catch(a){}
assert true;
if (x) {} else {};
return;
}
}
''');
assertResponse(r'''
replacement
right: 2
suggestions
return
kind: keyword
if
kind: keyword
final
kind: keyword
var
kind: keyword
super
kind: keyword
throw
kind: keyword
for
kind: keyword
this
kind: keyword
switch
kind: keyword
try
kind: keyword
assert
kind: keyword
break
kind: keyword
continue
kind: keyword
do
kind: keyword
dynamic
kind: keyword
false
kind: keyword
late
kind: keyword
null
kind: keyword
true
kind: keyword
void
kind: keyword
while
kind: keyword
''');
}
@failingTest
Future<void> test_014_3() async {
await computeSuggestions('''
class Q {
bool x;
List zs;
int k;
var a;
void mth() {
while (z) { continue; };
do{ break; } ^while(x);
for(z in zs) {}
for (int i; i < 3; i++);
switch(k) {case 1:{} default:{}}
try {
} on Object catch(a){}
assert true;
if (x) {} else {};
return;
}
}
''');
assertResponse(r'''
replacement
right: 5
suggestions
while
kind: keyword
''');
}
Future<void> test_014_4() async {
await computeSuggestions('''
class Q {
bool x;
List zs;
int k;
var a;
void mth() {
while (z) { continue; };
do{ break; } while(x);
^for(z in zs) {}
for (int i; i < 3; i++);
switch(k) {case 1:{} default:{}}
try {
} on Object catch(a){}
assert true;
if (x) {} else {};
return;
}
}
''');
assertResponse(r'''
replacement
right: 3
suggestions
return
kind: keyword
if
kind: keyword
final
kind: keyword
var
kind: keyword
super
kind: keyword
throw
kind: keyword
for
kind: keyword
this
kind: keyword
switch
kind: keyword
try
kind: keyword
assert
kind: keyword
break
kind: keyword
continue
kind: keyword
do
kind: keyword
dynamic
kind: keyword
false
kind: keyword
late
kind: keyword
null
kind: keyword
true
kind: keyword
void
kind: keyword
while
kind: keyword
''');
}
Future<void> test_014_5() async {
await computeSuggestions('''
class Q {
bool x;
List zs;
int k;
var a;
void mth() {
while (z) { continue; };
do{ break; } while(x);
for(z ^in zs) {}
for (int i; i < 3; i++);
switch(k) {case 1:{} default:{}}
try {
} on Object catch(a){}
assert true;
if (x) {} else {};
return;
}
}
''');
assertResponse(r'''
replacement
right: 2
suggestions
in
kind: keyword
''');
}
Future<void> test_014_6() async {
await computeSuggestions('''
class Q {
bool x;
List zs;
int k;
var a;
void mth() {
while (z) { continue; };
do{ break; } while(x);
for(z in zs) {}
^for (int i; i < 3; i++);
switch(k) {case 1:{} default:{}}
try {
} on Object catch(a){}
assert true;
if (x) {} else {};
return;
}
}
''');
assertResponse(r'''
replacement
right: 3
suggestions
return
kind: keyword
if
kind: keyword
final
kind: keyword
var
kind: keyword
super
kind: keyword
throw
kind: keyword
for
kind: keyword
this
kind: keyword
switch
kind: keyword
try
kind: keyword
assert
kind: keyword
break
kind: keyword
continue
kind: keyword
do
kind: keyword
dynamic
kind: keyword
false
kind: keyword
late
kind: keyword
null
kind: keyword
true
kind: keyword
void
kind: keyword
while
kind: keyword
''');
}
Future<void> test_014_7() async {
await computeSuggestions('''
class Q {
bool x;
List zs;
int k;
var a;
void mth() {
while (z) { continue; };
do{ break; } while(x);
for(z in zs) {}
for (int i; i < 3; i++);
^switch(k) {case 1:{} default:{}}
try {
} on Object catch(a){}
assert true;
if (x) {} else {};
return;
}
}
''');
assertResponse(r'''
replacement
right: 6
suggestions
return
kind: keyword
if
kind: keyword
final
kind: keyword
var
kind: keyword
super
kind: keyword
throw
kind: keyword
for
kind: keyword
this
kind: keyword
switch
kind: keyword
try
kind: keyword
assert
kind: keyword
break
kind: keyword
const
kind: keyword
do
kind: keyword
dynamic
kind: keyword
false
kind: keyword
late
kind: keyword
null
kind: keyword
true
kind: keyword
void
kind: keyword
while
kind: keyword
''');
}
Future<void> test_014_8() async {
await computeSuggestions('''
class Q {
bool x;
List zs;
int k;
var a;
void mth() {
while (z) { continue; };
do{ break; } while(x);
for(z in zs) {}
for (int i; i < 3; i++);
switch(k) {^case 1:{} default:{}}
try {
} on Object catch(a){}
assert true;
if (x) {} else {};
return;
}
}
''');
assertResponse(r'''
replacement
right: 4
suggestions
case
kind: keyword
''');
}
Future<void> test_014_9() async {
await computeSuggestions('''
class Q {
bool x;
List zs;
int k;
var a;
void mth() {
while (z) { continue; };
do{ break; } while(x);
for(z in zs) {}
for (int i; i < 3; i++);
switch(k) {case 1:{} ^default:{}}
try {
} on Object catch(a){}
assert true;
if (x) {} else {};
return;
}
}
''');
assertResponse(r'''
replacement
right: 7
suggestions
case
kind: keyword
default:
kind: keyword
''');
}
Future<void> test_014_A() async {
await computeSuggestions('''
class Q {
bool x;
List zs;
int k;
var a;
void mth() {
while (z) { continue; };
do{ break; } while(x);
for(z in zs) {}
for (int i; i < 3; i++);
switch(k) {case 1:{} default:{}}
^try {
} on Object catch(a){}
assert true;
if (x) {} else {};
return;
}
}
''');
assertResponse(r'''
replacement
right: 3
suggestions
return
kind: keyword
if
kind: keyword
final
kind: keyword
var
kind: keyword
super
kind: keyword
throw
kind: keyword
for
kind: keyword
this
kind: keyword
switch
kind: keyword
try
kind: keyword
assert
kind: keyword
do
kind: keyword
dynamic
kind: keyword
false
kind: keyword
late
kind: keyword
null
kind: keyword
true
kind: keyword
void
kind: keyword
while
kind: keyword
''');
}
Future<void> test_014_B() async {
await computeSuggestions('''
class Q {
bool x;
List zs;
int k;
var a;
void mth() {
while (z) { continue; };
do{ break; } while(x);
for(z in zs) {}
for (int i; i < 3; i++);
switch(k) {case 1:{} default:{}}
try {
} ^on Object catch(a){}
assert true;
if (x) {} else {};
return;
}
}
''');
assertResponse(r'''
replacement
right: 2
suggestions
on
kind: keyword
''');
}
Future<void> test_014_C() async {
await computeSuggestions('''
class Q {
bool x;
List zs;
int k;
var a;
void mth() {
while (z) { continue; };
do{ break; } while(x);
for(z in zs) {}
for (int i; i < 3; i++);
switch(k) {case 1:{} default:{}}
try {
} on Object ^catch(a){}
assert true;
if (x) {} else {};
return;
}
}
''');
assertResponse(r'''
replacement
right: 5
suggestions
catch
kind: keyword
''');
}
Future<void> test_014_D() async {
await computeSuggestions('''
class Q {
bool x;
List zs;
int k;
^var a;
void mth() {
while (z) { continue; };
do{ break; } while(x);
for(z in zs) {}
for (int i; i < 3; i++);
switch(k) {case 1:{} default:{}}
try {
} on Object catch(a){}
assert true;
if (x) {} else {};
return;
}
}
''');
assertResponse(r'''
replacement
right: 3
suggestions
final
kind: keyword
const
kind: keyword
var
kind: keyword
abstract
kind: keyword
covariant
kind: keyword
dynamic
kind: keyword
external
kind: keyword
late
kind: keyword
static
kind: keyword
void
kind: keyword
''');
}
Future<void> test_014_E() async {
await computeSuggestions('''
class Q {
bool x;
List zs;
int k;
var a;
^void mth() {
while (z) { continue; };
do{ break; } while(x);
for(z in zs) {}
for (int i; i < 3; i++);
switch(k) {case 1:{} default:{}}
try {
} on Object catch(a){}
assert true;
if (x) {} else {};
return;
}
}
''');
assertResponse(r'''
replacement
right: 4
suggestions
final
kind: keyword
static
kind: keyword
void
kind: keyword
const
kind: keyword
set
kind: keyword
factory
kind: keyword
covariant
kind: keyword
dynamic
kind: keyword
get
kind: keyword
late
kind: keyword
operator
kind: keyword
var
kind: keyword
''');
}
Future<void> test_014_F() async {
await computeSuggestions('''
class Q {
bool x;
List zs;
int k;
var a;
void mth() {
while (z) { continue; };
do{ break; } while(x);
for(z in zs) {}
for (int i; i < 3; i++);
switch(k) {case 1:{} default:{}}
try {
} on Object catch(a){}
^assert true;
if (x) {} else {};
return;
}
}
''');
assertResponse(r'''
replacement
right: 6
suggestions
return
kind: keyword
if
kind: keyword
final
kind: keyword
var
kind: keyword
super
kind: keyword
throw
kind: keyword
for
kind: keyword
this
kind: keyword
switch
kind: keyword
try
kind: keyword
assert
kind: keyword
do
kind: keyword
dynamic
kind: keyword
false
kind: keyword
late
kind: keyword
null
kind: keyword
true
kind: keyword
void
kind: keyword
while
kind: keyword
''');
}
Future<void> test_014_G() async {
await computeSuggestions('''
class Q {
bool x;
List zs;
int k;
var a;
void mth() {
while (z) { ^continue; };
do{ break; } while(x);
for(z in zs) {}
for (int i; i < 3; i++);
switch(k) {case 1:{} default:{}}
try {
} on Object catch(a){}
assert true;
if (x) {} else {};
return;
}
}
''');
assertResponse(r'''
replacement
right: 8
suggestions
continue
kind: keyword
''');
}
Future<void> test_014_H() async {
await computeSuggestions('''
class Q {
bool x;
List zs;
int k;
var a;
void mth() {
while (z) { continue; };
do{ ^break; } while(x);
for(z in zs) {}
for (int i; i < 3; i++);
switch(k) {case 1:{} default:{}}
try {
} on Object catch(a){}
assert true;
if (x) {} else {};
return;
}
}
''');
assertResponse(r'''
replacement
right: 5
suggestions
break
kind: keyword
''');
}
Future<void> test_014_J() async {
await computeSuggestions('''
class Q {
bool x;
List zs;
int k;
var a;
void mth() {
while (z) { continue; };
do{ break; } while(x);
for(z in zs) {}
for (int i; i < 3; i++);
switch(k) {case 1:{} default:{}}
try {
} on Object catch(a){}
assert true;
^if (x) {} else {};
return;
}
}
''');
assertResponse(r'''
replacement
right: 2
suggestions
return
kind: keyword
if
kind: keyword
final
kind: keyword
var
kind: keyword
super
kind: keyword
throw
kind: keyword
for
kind: keyword
this
kind: keyword
switch
kind: keyword
try
kind: keyword
assert
kind: keyword
const
kind: keyword
do
kind: keyword
dynamic
kind: keyword
false
kind: keyword
late
kind: keyword
null
kind: keyword
true
kind: keyword
void
kind: keyword
while
kind: keyword
''');
}
@failingTest
Future<void> test_014_K() async {
await computeSuggestions('''
class Q {
bool x;
List zs;
int k;
var a;
void mth() {
while (z) { continue; };
do{ break; } while(x);
for(z in zs) {}
for (int i; i < 3; i++);
switch(k) {case 1:{} default:{}}
try {
} on Object catch(a){}
assert true;
if (x) {} ^else {};
return;
}
}
''');
assertResponse(r'''
replacement
right: 4
suggestions
assert
kind: keyword
const
kind: keyword
do
kind: keyword
dynamic
kind: keyword
else
kind: keyword
false
kind: keyword
final
kind: keyword
for
kind: keyword
if
kind: keyword
late
kind: keyword
null
kind: keyword
return
kind: keyword
super
kind: keyword
switch
kind: keyword
this
kind: keyword
throw
kind: keyword
true
kind: keyword
try
kind: keyword
var
kind: keyword
void
kind: keyword
while
kind: keyword
''');
}
Future<void> test_014_L() async {
await computeSuggestions('''
class Q {
bool x;
List zs;
int k;
var a;
void mth() {
while (z) { continue; };
do{ break; } while(x);
for(z in zs) {}
for (int i; i < 3; i++);
switch(k) {case 1:{} default:{}}
try {
} on Object catch(a){}
assert true;
if (x) {} else {};
^return;
}
}
''');
assertResponse(r'''
replacement
right: 6
suggestions
return
kind: keyword
if
kind: keyword
final
kind: keyword
var
kind: keyword
super
kind: keyword
throw
kind: keyword
for
kind: keyword
this
kind: keyword
switch
kind: keyword
try
kind: keyword
assert
kind: keyword
do
kind: keyword
dynamic
kind: keyword
false
kind: keyword
late
kind: keyword
null
kind: keyword
true
kind: keyword
void
kind: keyword
while
kind: keyword
''');
}
Future<void> test_015_1() async {
allowedIdentifiers = {'=='};
await computeSuggestions('''
f(a,b,c) => a + b * c ^;
''');
assertResponse(r'''
suggestions
''');
}
Future<void> test_016_1() async {
allowedIdentifiers = {'=='};
await computeSuggestions('''
class X {dynamic f(a,b,c) {return a + b * c ^;}}
''');
assertResponse(r'''
suggestions
true
kind: keyword
null
kind: keyword
false
kind: keyword
this
kind: keyword
const
kind: keyword
super
kind: keyword
switch
kind: keyword
''');
}
@failingTest
Future<void> test_017_1() async {
await computeSuggestions('''
^import 'x' as r;
export 'uri' hide Q show X;
part 'x';
''');
assertResponse(r'''
replacement
right: 6
suggestions
library
kind: keyword
''');
}
@failingTest
Future<void> test_017_2() async {
await computeSuggestions('''
^import 'x' as r;
export 'uri' hide Q show X;
part 'x';
''');
assertResponse(r'''
replacement
right: 6
suggestions
import
kind: keyword
''');
}
@failingTest
Future<void> test_017_3() async {
await computeSuggestions('''
import 'x' as r;
^export 'uri' hide Q show X;
part 'x';
''');
assertResponse(r'''
replacement
right: 6
suggestions
export
kind: keyword
''');
}
@failingTest
Future<void> test_017_4() async {
await computeSuggestions('''
import 'x' as r;
export 'uri' hide Q show X;
^part 'x';
''');
assertResponse(r'''
replacement
right: 4
suggestions
part
kind: keyword
''');
}
@failingTest
Future<void> test_017_5() async {
await computeSuggestions('''
import 'x' ^as r;
export 'uri' hide Q show X;
part 'x';
''');
assertResponse(r'''
replacement
right: 2
suggestions
as
kind: keyword
''');
}
@failingTest
Future<void> test_017_6() async {
await computeSuggestions('''
import 'x' as r;
export 'uri' ^hide Q show X;
part 'x';
''');
assertResponse(r'''
replacement
right: 4
suggestions
hide
kind: keyword
''');
}
@failingTest
Future<void> test_017_7() async {
await computeSuggestions('''
import 'x' as r;
export 'uri' hide Q ^show X;
part 'x';
''');
assertResponse(r'''
replacement
right: 4
suggestions
show
kind: keyword
''');
}
Future<void> test_017_8() async {
await computeSuggestions('''
import 'x' as r;
export '^uri' hide Q show X;
part 'x';
''');
assertResponse(r'''
replacement
right: 3
suggestions
dart:
kind: import
dart:async
kind: import
dart:async2
kind: import
dart:collection
kind: import
dart:convert
kind: import
dart:ffi
kind: import
dart:html
kind: import
dart:io
kind: import
dart:isolate
kind: import
dart:js
kind: import
dart:js_interop
kind: import
dart:math
kind: import
dart:typed_data
kind: import
package:
kind: import
package:test/
kind: import
package:test/test.dart
kind: import
dart:core
kind: import
''');
}
@failingTest
Future<void> test_018_1() async {
await computeSuggestions('''
^part of foo;
''');
assertResponse(r'''
replacement
right: 4
suggestions
part
kind: keyword
''');
}
@failingTest
Future<void> test_018_2() async {
await computeSuggestions('''
part ^of foo;
''');
assertResponse(r'''
replacement
right: 2
suggestions
of
kind: keyword
''');
}
Future<void> test_019_1() async {
allowedIdentifiers = {'true', 'truefalse', 'falsetrue'};
await computeSuggestions('''
var truefalse = 0;
var falsetrue = 1;
void f() {
var foo = true^
}
''');
assertResponse(r'''
replacement
left: 4
suggestions
falsetrue
kind: topLevelVariable
truefalse
kind: topLevelVariable
true
kind: keyword
''');
}
Future<void> test_020_1() async {
allowedIdentifiers = {'toString'};
await computeSuggestions('''
var x = null.^
''');
assertResponse(r'''
suggestions
toString
kind: methodInvocation
''');
}
Future<void> test_021_1() async {
allowedIdentifiers = {'toString'};
await computeSuggestions('''
var x = .^
''');
assertResponse(r'''
suggestions
''');
}
Future<void> test_022_1() async {
allowedIdentifiers = {'toString'};
await computeSuggestions('''
var x = .^;
''');
assertResponse(r'''
suggestions
''');
}
Future<void> test_023_1() async {
allowedIdentifiers = {'getKeys'};
await computeSuggestions('''
class Map{getKeys(){}}
class X {
static x1(Map m) {
m.^getKeys;
}
x2(Map m) {
m.getKeys;
}
}
''');
assertResponse(r'''
replacement
right: 7
suggestions
getKeys
kind: methodInvocation
''');
}
Future<void> test_023_2() async {
allowedIdentifiers = {'getKeys'};
await computeSuggestions('''
class Map{getKeys(){}}
class X {
static x1(Map m) {
m.getKeys;
}
x2(Map m) {
m.^getKeys;
}
}
''');
assertResponse(r'''
replacement
right: 7
suggestions
getKeys
kind: methodInvocation
''');
}
Future<void> test_024_1() async {
allowedIdentifiers = {'from'};
await computeSuggestions('''
class List{factory List.from(Iterable other) {}}
class F {
f() {
new List.^
}
}
''');
assertResponse(r'''
suggestions
from
kind: constructorInvocation
''');
}
Future<void> test_025_1() async {
allowedIdentifiers = {'m'};
await computeSuggestions('''
class R {
static R _m;
static R m;
f() {
var a = ^m;
var b = _m;
var c = g();
}
static g() {
var a = m;
var b = _m;
var c = g();
}
}
class T {
f() {
R x;
x.g();
x.m;
x._m;
}
static g() {
var q = R._m;
var g = R.m;
var h = R.g();
}
h() {
var q = R._m;
var g = R.m;
var h = R.g();
}
}
''');
assertResponse(r'''
replacement
right: 1
suggestions
m
kind: field
const
kind: keyword
false
kind: keyword
true
kind: keyword
null
kind: keyword
super
kind: keyword
switch
kind: keyword
this
kind: keyword
''');
}
Future<void> test_025_2() async {
allowedIdentifiers = {'_m'};
await computeSuggestions('''
class R {
static R _m;
static R m;
f() {
var a = m;
var b = _^m;
var c = g();
}
static g() {
var a = m;
var b = _m;
var c = g();
}
}
class T {
f() {
R x;
x.g();
x.m;
x._m;
}
static g() {
var q = R._m;
var g = R.m;
var h = R.g();
}
h() {
var q = R._m;
var g = R.m;
var h = R.g();
}
}
''');
assertResponse(r'''
replacement
left: 1
right: 1
suggestions
_m
kind: field
''');
}
Future<void> test_025_3() async {
allowedIdentifiers = {'g'};
await computeSuggestions('''
class R {
static R _m;
static R m;
f() {
var a = m;
var b = _m;
var c = ^g();
}
static g() {
var a = m;
var b = _m;
var c = g();
}
}
class T {
f() {
R x;
x.g();
x.m;
x._m;
}
static g() {
var q = R._m;
var g = R.m;
var h = R.g();
}
h() {
var q = R._m;
var g = R.m;
var h = R.g();
}
}
''');
assertResponse(r'''
replacement
right: 1
suggestions
const
kind: keyword
false
kind: keyword
g
kind: methodInvocation
true
kind: keyword
null
kind: keyword
super
kind: keyword
switch
kind: keyword
this
kind: keyword
''');
}
Future<void> test_025_4() async {
allowedIdentifiers = {'m'};
await computeSuggestions('''
class R {
static R _m;
static R m;
f() {
var a = m;
var b = _m;
var c = g();
}
static g() {
var a = ^m;
var b = _m;
var c = g();
}
}
class T {
f() {
R x;
x.g();
x.m;
x._m;
}
static g() {
var q = R._m;
var g = R.m;
var h = R.g();
}
h() {
var q = R._m;
var g = R.m;
var h = R.g();
}
}
''');
assertResponse(r'''
replacement
right: 1
suggestions
m
kind: field
const
kind: keyword
false
kind: keyword
true
kind: keyword
null
kind: keyword
switch
kind: keyword
''');
}
Future<void> test_025_5() async {
allowedIdentifiers = {'_m'};
await computeSuggestions('''
class R {
static R _m;
static R m;
f() {
var a = m;
var b = _m;
var c = g();
}
static g() {
var a = m;
var b = _^m;
var c = g();
}
}
class T {
f() {
R x;
x.g();
x.m;
x._m;
}
static g() {
var q = R._m;
var g = R.m;
var h = R.g();
}
h() {
var q = R._m;
var g = R.m;
var h = R.g();
}
}
''');
assertResponse(r'''
replacement
left: 1
right: 1
suggestions
_m
kind: field
''');
}
Future<void> test_025_6() async {
allowedIdentifiers = {'g'};
await computeSuggestions('''
class R {
static R _m;
static R m;
f() {
var a = m;
var b = _m;
var c = g();
}
static g() {
var a = m;
var b = _m;
var c = ^g();
}
}
class T {
f() {
R x;
x.g();
x.m;
x._m;
}
static g() {
var q = R._m;
var g = R.m;
var h = R.g();
}
h() {
var q = R._m;
var g = R.m;
var h = R.g();
}
}
''');
assertResponse(r'''
replacement
right: 1
suggestions
const
kind: keyword
false
kind: keyword
g
kind: methodInvocation
true
kind: keyword
null
kind: keyword
switch
kind: keyword
''');
}
Future<void> test_025_7() async {
allowedIdentifiers = {'g'};
await computeSuggestions('''
class R {
static R _m;
static R m;
f() {
var a = m;
var b = _m;
var c = g();
}
static g() {
var a = m;
var b = _m;
var c = g();
}
}
class T {
f() {
R x;
x.^g();
x.m;
x._m;
}
static g() {
var q = R._m;
var g = R.m;
var h = R.g();
}
h() {
var q = R._m;
var g = R.m;
var h = R.g();
}
}
''');
assertResponse(r'''
replacement
right: 1
suggestions
''');
}
Future<void> test_025_8() async {
allowedIdentifiers = {'m'};
await computeSuggestions('''
class R {
static R _m;
static R m;
f() {
var a = m;
var b = _m;
var c = g();
}
static g() {
var a = m;
var b = _m;
var c = g();
}
}
class T {
f() {
R x;
x.g();
x.^m;
x._m;
}
static g() {
var q = R._m;
var g = R.m;
var h = R.g();
}
h() {
var q = R._m;
var g = R.m;
var h = R.g();
}
}
''');
assertResponse(r'''
replacement
right: 1
suggestions
''');
}
Future<void> test_025_9() async {
allowedIdentifiers = {'_m'};
await computeSuggestions('''
class R {
static R _m;
static R m;
f() {
var a = m;
var b = _m;
var c = g();
}
static g() {
var a = m;
var b = _m;
var c = g();
}
}
class T {
f() {
R x;
x.g();
x.m;
x._^m;
}
static g() {
var q = R._m;
var g = R.m;
var h = R.g();
}
h() {
var q = R._m;
var g = R.m;
var h = R.g();
}
}
''');
assertResponse(r'''
replacement
left: 1
right: 1
suggestions
''');
}
Future<void> test_025_A() async {
allowedIdentifiers = {'_m'};
await computeSuggestions('''
class R {
static R _m;
static R m;
f() {
var a = m;
var b = _m;
var c = g();
}
static g() {
var a = m;
var b = _m;
var c = g();
}
}
class T {
f() {
R x;
x.g();
x.m;
x._m;
}
static g() {
var q = R._^m;
var g = R.m;
var h = R.g();
}
h() {
var q = R._m;
var g = R.m;
var h = R.g();
}
}
''');
assertResponse(r'''
replacement
left: 1
right: 1
suggestions
_m
kind: field
''');
}
Future<void> test_025_B() async {
allowedIdentifiers = {'m'};
await computeSuggestions('''
class R {
static R _m;
static R m;
f() {
var a = m;
var b = _m;
var c = g();
}
static g() {
var a = m;
var b = _m;
var c = g();
}
}
class T {
f() {
R x;
x.g();
x.m;
x._m;
}
static g() {
var q = R._m;
var g = R.^m;
var h = R.g();
}
h() {
var q = R._m;
var g = R.m;
var h = R.g();
}
}
''');
assertResponse(r'''
replacement
right: 1
suggestions
m
kind: field
''');
}
Future<void> test_025_C() async {
allowedIdentifiers = {'g'};
await computeSuggestions('''
class R {
static R _m;
static R m;
f() {
var a = m;
var b = _m;
var c = g();
}
static g() {
var a = m;
var b = _m;
var c = g();
}
}
class T {
f() {
R x;
x.g();
x.m;
x._m;
}
static g() {
var q = R._m;
var g = R.m;
var h = R.^g();
}
h() {
var q = R._m;
var g = R.m;
var h = R.g();
}
}
''');
assertResponse(r'''
replacement
right: 1
suggestions
g
kind: methodInvocation
''');
}
Future<void> test_025_D() async {
allowedIdentifiers = {'_m'};
await computeSuggestions('''
class R {
static R _m;
static R m;
f() {
var a = m;
var b = _m;
var c = g();
}
static g() {
var a = m;
var b = _m;
var c = g();
}
}
class T {
f() {
R x;
x.g();
x.m;
x._m;
}
static g() {
var q = R._m;
var g = R.m;
var h = R.g();
}
h() {
var q = R._^m;
var g = R.m;
var h = R.g();
}
}
''');
assertResponse(r'''
replacement
left: 1
right: 1
suggestions
_m
kind: field
''');
}
Future<void> test_025_E() async {
allowedIdentifiers = {'m'};
await computeSuggestions('''
class R {
static R _m;
static R m;
f() {
var a = m;
var b = _m;
var c = g();
}
static g() {
var a = m;
var b = _m;
var c = g();
}
}
class T {
f() {
R x;
x.g();
x.m;
x._m;
}
static g() {
var q = R._m;
var g = R.m;
var h = R.g();
}
h() {
var q = R._m;
var g = R.^m;
var h = R.g();
}
}
''');
assertResponse(r'''
replacement
right: 1
suggestions
m
kind: field
''');
}
Future<void> test_025_F() async {
allowedIdentifiers = {'g'};
await computeSuggestions('''
class R {
static R _m;
static R m;
f() {
var a = m;
var b = _m;
var c = g();
}
static g() {
var a = m;
var b = _m;
var c = g();
}
}
class T {
f() {
R x;
x.g();
x.m;
x._m;
}
static g() {
var q = R._m;
var g = R.m;
var h = R.g();
}
h() {
var q = R._m;
var g = R.m;
var h = R.^g();
}
}
''');
assertResponse(r'''
replacement
right: 1
suggestions
g
kind: methodInvocation
''');
}
Future<void> test_026_1() async {
allowedIdentifiers = {'aBcD'};
await computeSuggestions('''
var aBcD; var x=ab^
''');
assertResponse(r'''
replacement
left: 2
suggestions
aBcD
kind: topLevelVariable
''');
}
Future<void> test_027_1() async {
allowedIdentifiers = {'ssss'};
await computeSuggestions('''
m(){try{}catch(eeee,ssss){s^}
''');
assertResponse(r'''
replacement
left: 1
suggestions
ssss
kind: localVariable
switch
kind: keyword
''');
}
@failingTest
Future<void> test_028_1() async {
allowedIdentifiers = {'isX'};
await computeSuggestions('''
m(){var isX=3;if(is^)
''');
assertResponse(r'''
replacement
left: 2
suggestions
is
kind: keyword
isX
kind: localVariable
''');
}
Future<void> test_029_1() async {
allowedIdentifiers = {'x'};
await computeSuggestions('''
m(){[1].forEach((x)=>^x);}
''');
assertResponse(r'''
replacement
right: 1
suggestions
x
kind: parameter
null
kind: keyword
false
kind: keyword
true
kind: keyword
const
kind: keyword
switch
kind: keyword
''');
}
Future<void> test_030_1() async {
allowedIdentifiers = {'x'};
await computeSuggestions('''
n(){[1].forEach((x){^});}
''');
assertResponse(r'''
suggestions
x
kind: parameter
return
kind: keyword
if
kind: keyword
final
kind: keyword
var
kind: keyword
throw
kind: keyword
for
kind: keyword
switch
kind: keyword
try
kind: keyword
assert
kind: keyword
const
kind: keyword
do
kind: keyword
dynamic
kind: keyword
false
kind: keyword
late
kind: keyword
null
kind: keyword
true
kind: keyword
void
kind: keyword
while
kind: keyword
''');
}
Future<void> test_031_1() async {
allowedIdentifiers = {'Caster', 'CastBlock'};
await computeSuggestions('''
class Caster {} m() {try {} on Cas^ter catch (CastBlock) {}}
''');
assertResponse(r'''
replacement
left: 3
right: 3
suggestions
Caster
kind: class
''');
}
Future<void> test_031_2() async {
allowedIdentifiers = {'Caster', 'CastBlock'};
await computeSuggestions('''
class Caster {} m() {try {} on Caster catch (CastBlock) {^}}
''');
assertResponse(r'''
suggestions
CastBlock
kind: localVariable
return
kind: keyword
if
kind: keyword
final
kind: keyword
Caster
kind: class
var
kind: keyword
throw
kind: keyword
for
kind: keyword
switch
kind: keyword
try
kind: keyword
Caster
kind: constructorInvocation
assert
kind: keyword
const
kind: keyword
do
kind: keyword
dynamic
kind: keyword
false
kind: keyword
late
kind: keyword
null
kind: keyword
rethrow
kind: keyword
true
kind: keyword
void
kind: keyword
while
kind: keyword
''');
}
Future<void> test_032_1() async {
allowedIdentifiers = {'ONE', 'UKSI'};
await computeSuggestions('''
const ONE = 1;
const ICHI = 10;
const UKSI = 100;
const EIN = 1000;
m() {
int x;
switch (x) {
case ICHI:
case UKSI:
case EIN:
case ONE^: return;
default: return;
}
}
''');
assertResponse(r'''
replacement
left: 3
suggestions
ONE
kind: topLevelVariable
''');
}
Future<void> test_032_2() async {
allowedIdentifiers = {'EIN', 'ICHI'};
await computeSuggestions('''
const ONE = 1;
const ICHI = 10;
const UKSI = 100;
const EIN = 1000;
m() {
int x;
switch (x) {
case ICHI:
case UKSI:
case EIN^:
case ONE: return;
default: return;
}
}
''');
assertResponse(r'''
replacement
left: 3
suggestions
EIN
kind: topLevelVariable
''');
}
@failingTest
Future<void> test_032_3() async {
allowedIdentifiers = {'ICHI', 'UKSI', 'EIN', 'ONE'};
await computeSuggestions('''
const ONE = 1;
const ICHI = 10;
const UKSI = 100;
const EIN = 1000;
m() {
int x;
switch (x) {
case ^ICHI:
case UKSI:
case EIN:
case ONE: return;
default: return;
}
}
''');
assertResponse(r'''
replacement
right: 4
suggestions
const
kind: keyword
EIN
kind: topLevelVariable
false
kind: keyword
final
kind: keyword
ICHI
kind: topLevelVariable
null
kind: keyword
ONE
kind: topLevelVariable
true
kind: keyword
UKSI
kind: topLevelVariable
var
kind: keyword
''');
}
Future<void> test_033_1() async {
allowedIdentifiers = {'b', 'c'};
await computeSuggestions('''
class A{}class B extends A{b(){}}class C implements A {c(){}}class X{x(){A f;f.^}}
''');
assertResponse(r'''
suggestions
''');
}
Future<void> test_034_1() async {
allowedIdentifiers = {'top'};
await computeSuggestions('''
var topvar;
class Top {top(){}}
class Left extends Top {left(){}}
class Right extends Top {right(){}}
t1() {
topvar = new Left();
}
t2() {
topvar = new Right();
}
class A {
var field;
a() {
field = new Left();
}
b() {
field = new Right();
}
test() {
topvar.^top();
field.top();
}
}
''');
assertResponse(r'''
replacement
right: 3
suggestions
''');
}
Future<void> test_034_2() async {
allowedIdentifiers = {'top'};
await computeSuggestions('''
var topvar;
class Top {top(){}}
class Left extends Top {left(){}}
class Right extends Top {right(){}}
t1() {
topvar = new Left();
}
t2() {
topvar = new Right();
}
class A {
var field;
a() {
field = new Left();
}
b() {
field = new Right();
}
test() {
topvar.top();
field.^top();
}
}
''');
assertResponse(r'''
replacement
right: 3
suggestions
''');
}
Future<void> test_035_1() async {
allowedIdentifiers = {'length'};
await computeSuggestions('''
class Y {final x='hi';mth() {x.^length;}}
''');
assertResponse(r'''
replacement
right: 6
suggestions
length
kind: getter
''');
}
Future<void> test_036_1() async {
allowedIdentifiers = {'round'};
await computeSuggestions('''
class A1 {
var field;
A1() : field = 0;
q() {
A1 a = new A1();
a.field.^
}
}
void f() {
A1 a = new A1();
a.field.
}
''');
assertResponse(r'''
suggestions
''');
}
Future<void> test_036_2() async {
allowedIdentifiers = {'round'};
await computeSuggestions('''
class A1 {
var field;
A1() : field = 0;
q() {
A1 a = new A1();
a.field.
}
}
void f() {
A1 a = new A1();
a.field.^
}
''');
assertResponse(r'''
suggestions
''');
}
Future<void> test_037_1() async {
allowedIdentifiers = {'HttpServer', 'HttpClient'};
await computeSuggestions('''
class HttpServer{}
class HttpClient{}
void f() {
new HtS^
}
''');
assertResponse(r'''
replacement
left: 3
suggestions
HttpServer
kind: constructorInvocation
''');
}
Future<void> test_038_1() async {
allowedIdentifiers = {'y', 'x'};
await computeSuggestions('''
class X {
x(){}
}
class Y {
y(){}
}
class A<Z extends X> {
Y ay;
Z az;
A(this.ay, this.az) {
ay.^y;
az.x;
}
}
''');
assertResponse(r'''
replacement
right: 1
suggestions
y
kind: methodInvocation
''');
}
Future<void> test_038_2() async {
allowedIdentifiers = {'x', 'y'};
await computeSuggestions('''
class X {
x(){}
}
class Y {
y(){}
}
class A<Z extends X> {
Y ay;
Z az;
A(this.ay, this.az) {
ay.y;
az.^x;
}
}
''');
assertResponse(r'''
replacement
right: 1
suggestions
x
kind: methodInvocation
''');
}
Future<void> test_039_1() async {
await computeSuggestions('''
class X{}var x = null as ^X;
''');
assertResponse(r'''
replacement
right: 1
suggestions
dynamic
kind: keyword
''');
}
Future<void> test_040_1() async {
await computeSuggestions('''
m(){f(a, b, {x1, x2, y}) {};f(1, 2, ^);}
''');
assertResponse(r'''
suggestions
|x1: |
kind: namedArgument
|x2: |
kind: namedArgument
|y: |
kind: namedArgument
''');
}
Future<void> test_040_2() async {
await computeSuggestions('''
m(){f(a, b, {x1, x2, y}) {};f(1, 2, )^;}
''');
assertResponse(r'''
suggestions
''');
}
Future<void> test_041_1() async {
allowedIdentifiers = {'y'};
await computeSuggestions('''
m(){f(a, b, {x1, x2, y}) {};f(1, 2, ^
''');
assertResponse(r'''
suggestions
|x1: |
kind: namedArgument
|x2: |
kind: namedArgument
|y: |
kind: namedArgument
''');
}
Future<void> test_042_1() async {
await computeSuggestions('''
m(){f(a, b, {x1, x2, y}) {};f(1, 2, ^;
''');
assertResponse(r'''
suggestions
|x1: |
kind: namedArgument
|x2: |
kind: namedArgument
|y: |
kind: namedArgument
''');
}
Future<void> test_042_2() async {
allowedIdentifiers = {'y'};
await computeSuggestions('''
m(){f(a, b, {x1, x2, y}) {};f(1, 2, ;^
''');
assertResponse(r'''
suggestions
return
kind: keyword
if
kind: keyword
final
kind: keyword
var
kind: keyword
throw
kind: keyword
for
kind: keyword
switch
kind: keyword
try
kind: keyword
assert
kind: keyword
const
kind: keyword
do
kind: keyword
dynamic
kind: keyword
false
kind: keyword
late
kind: keyword
null
kind: keyword
true
kind: keyword
void
kind: keyword
while
kind: keyword
''');
}
Future<void> test_classMembers_inGetter_1() async {
allowedIdentifiers = {'fff'};
await computeSuggestions('''
class A { var fff; get z {ff^}}
''');
assertResponse(r'''
replacement
left: 2
suggestions
fff
kind: field
''');
}
Future<void> test_commentSnippets001_1() async {
allowedIdentifiers = {'MAX'};
await computeSuggestions('''
class X {static final num MAX = 0;num yc,xc;mth() {xc = yc = MA^X;xc.abs();num f = MAX;}}
''');
assertResponse(r'''
replacement
left: 2
right: 1
suggestions
MAX
kind: field
''');
}
Future<void> test_commentSnippets001_2() async {
allowedIdentifiers = {'xc'};
await computeSuggestions('''
class X {static final num MAX = 0;num yc,xc;mth() {xc = yc = MAX;x^c.abs();num f = MAX;}}
''');
assertResponse(r'''
replacement
left: 1
right: 1
suggestions
xc
kind: field
''');
}
Future<void> test_commentSnippets001_3() async {
allowedIdentifiers = {'MAX'};
await computeSuggestions('''
class X {static final num MAX = 0;num yc,xc;mth() {xc = yc = MAX;xc.abs();num f = M^AX;}}
''');
assertResponse(r'''
replacement
left: 1
right: 2
suggestions
MAX
kind: field
''');
}
Future<void> test_commentSnippets002_1() async {
allowedIdentifiers = {'length'};
await computeSuggestions('''
class Y {String x='hi';mth() {x.l^ength;int n = 0;x.codeUnitAt(n);}}
''');
assertResponse(r'''
replacement
left: 1
right: 5
suggestions
length
kind: getter
''');
}
Future<void> test_commentSnippets002_2() async {
allowedIdentifiers = {'x'};
await computeSuggestions('''
class Y {String x='hi';mth() {x.length;int n = 0;x^.codeUnitAt(n);}}
''');
assertResponse(r'''
replacement
left: 1
suggestions
x
kind: field
''');
}
Future<void> test_commentSnippets002_3() async {
allowedIdentifiers = {'n'};
await computeSuggestions('''
class Y {String x='hi';mth() {x.length;int n = 0;x.codeUnitAt(n^);}}
''');
assertResponse(r'''
replacement
left: 1
suggestions
n
kind: localVariable
null
kind: keyword
''');
}
Future<void> test_commentSnippets004_1() async {
allowedIdentifiers = {'A'};
await computeSuggestions('''
class A {^int x; mth() {int y = this.x;}}class B{}
''');
assertResponse(r'''
replacement
right: 3
suggestions
@override
// TODO: implement hashCode
int get hashCode => super.hashCode;
kind: override
selection: 62 14
@override
// TODO: implement runtimeType
Type get runtimeType => super.runtimeType;
kind: override
selection: 69 17
@override
String toString() {
// TODO: implement toString
return super.toString();
}
kind: override
selection: 68 24
@override
bool operator ==(Object other) {
// TODO: implement ==
return super == other;
}
kind: override
selection: 75 22
@override
noSuchMethod(Invocation invocation) {
// TODO: implement noSuchMethod
return super.noSuchMethod(invocation);
}
kind: override
selection: 90 38
A
kind: class
final
kind: keyword
static
kind: keyword
void
kind: keyword
const
kind: keyword
set
kind: keyword
factory
kind: keyword
covariant
kind: keyword
dynamic
kind: keyword
get
kind: keyword
late
kind: keyword
operator
kind: keyword
var
kind: keyword
''');
}
Future<void> test_commentSnippets004_2() async {
allowedIdentifiers = {'B'};
await computeSuggestions('''
class A {int x; ^mth() {int y = this.x;}}class B{}
''');
assertResponse(r'''
replacement
right: 3
suggestions
B
kind: class
final
kind: keyword
static
kind: keyword
void
kind: keyword
const
kind: keyword
set
kind: keyword
factory
kind: keyword
covariant
kind: keyword
dynamic
kind: keyword
get
kind: keyword
late
kind: keyword
operator
kind: keyword
var
kind: keyword
''');
}
Future<void> test_commentSnippets004_3() async {
allowedIdentifiers = {'x', 'y'};
await computeSuggestions('''
class A {int x; mth() {^int y = this.x;}}class B{}
''');
assertResponse(r'''
replacement
right: 3
suggestions
return
kind: keyword
x
kind: field
if
kind: keyword
final
kind: keyword
var
kind: keyword
super
kind: keyword
throw
kind: keyword
for
kind: keyword
this
kind: keyword
switch
kind: keyword
try
kind: keyword
assert
kind: keyword
const
kind: keyword
do
kind: keyword
dynamic
kind: keyword
false
kind: keyword
late
kind: keyword
null
kind: keyword
true
kind: keyword
void
kind: keyword
while
kind: keyword
''');
}
Future<void> test_commentSnippets004_5() async {
allowedIdentifiers = {'mth'};
await computeSuggestions('''
class A {int x; mth() {int y = this.^x;}}class B{}
''');
assertResponse(r'''
replacement
right: 1
suggestions