mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 08:24:39 +00:00
Test for Expression.inConstantContext when the expression is RecordLiteral.
Change-Id: I1330b966296e9521bdb0d5e576cd1a63f2c5fbdc Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/260077 Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
This commit is contained in:
parent
141556c15f
commit
1ad52e061a
|
@ -580,6 +580,48 @@ f(v) {
|
|||
''');
|
||||
assertInContext("{}", true);
|
||||
}
|
||||
|
||||
test_inConstantContext_recordLiteral_listLiteral_false() {
|
||||
parse('''
|
||||
final x = [0, (1, 2)];
|
||||
''');
|
||||
assertInContext('(1, 2)', false);
|
||||
}
|
||||
|
||||
test_inConstantContext_recordLiteral_listLiteral_true() {
|
||||
parse('''
|
||||
final x = const [0, (1, 2)];
|
||||
''');
|
||||
assertInContext('(1, 2)', true);
|
||||
}
|
||||
|
||||
test_inConstantContext_recordLiteral_namedFields_recordLiteral_false() {
|
||||
parse('''
|
||||
final x = (0, foo: (1, 2));
|
||||
''');
|
||||
assertInContext('(1, 2)', false);
|
||||
}
|
||||
|
||||
test_inConstantContext_recordLiteral_namedFields_recordLiteral_true() {
|
||||
parse('''
|
||||
final x = const (0, foo: (1, 2));
|
||||
''');
|
||||
assertInContext('(1, 2)', true);
|
||||
}
|
||||
|
||||
test_inConstantContext_recordLiteral_positionalFields_recordLiteral_false() {
|
||||
parse('''
|
||||
final x = (0, (1, 2));
|
||||
''');
|
||||
assertInContext('(1, 2)', false);
|
||||
}
|
||||
|
||||
test_inConstantContext_recordLiteral_positionalFields_recordLiteral_true() {
|
||||
parse('''
|
||||
final x = const (0, (1, 2));
|
||||
''');
|
||||
assertInContext('(1, 2)', true);
|
||||
}
|
||||
}
|
||||
|
||||
@reflectiveTest
|
||||
|
|
Loading…
Reference in a new issue