Skip to content

Commit 4d0ef25

Browse files
biggs0125natebiggs
andauthored
Update pattern test to account for new DDC JS variable naming (#2542)
* Update pattern test to account for new DDC JS variable naming A bug recently uncovered in DDC required renaming some variables (primarily around patterns) to avoid declarations from shadowing each other incorrectly. 'a' is now 'a$' as it is the second case that declares a Dart variable named 'a'. --------- Co-authored-by: Nate Biggs <natebiggs@google.com>
1 parent ab620d1 commit 4d0ef25

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

dwds/test/instances/common/patterns_inspection_common.dart

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import 'package:test/test.dart';
66
import 'package:test_common/logging.dart';
77
import 'package:test_common/test_sdk_configuration.dart';
8+
import 'package:test_common/utilities.dart';
89
import 'package:vm_service/vm_service.dart';
910

1011
import '../../fixtures/context.dart';
@@ -96,11 +97,24 @@ void runTests({
9697
await onBreakPoint('testPatternCase2', (event) async {
9798
final frame = event.topFrame!;
9899

99-
expect(await getFrameVariables(frame), {
100-
'obj': matchListInstance(type: 'Object'),
101-
'a': matchPrimitiveInstance(kind: InstanceKind.kString, value: 'b'),
102-
'n': matchPrimitiveInstance(kind: InstanceKind.kDouble, value: 3.14),
103-
});
100+
if (dartSdkIsAtLeast('3.7.0-246.0.dev')) {
101+
expect(await getFrameVariables(frame), {
102+
'obj': matchListInstance(type: 'Object'),
103+
// Renamed to avoid shadowing variables from previous case.
104+
'a\$':
105+
matchPrimitiveInstance(kind: InstanceKind.kString, value: 'b'),
106+
'n\$':
107+
matchPrimitiveInstance(kind: InstanceKind.kDouble, value: 3.14),
108+
});
109+
} else {
110+
expect(await getFrameVariables(frame), {
111+
'obj': matchListInstance(type: 'Object'),
112+
// Renamed to avoid shadowing variables from previous case.
113+
'a': matchPrimitiveInstance(kind: InstanceKind.kString, value: 'b'),
114+
'n':
115+
matchPrimitiveInstance(kind: InstanceKind.kDouble, value: 3.14),
116+
});
117+
}
104118
});
105119
});
106120

0 commit comments

Comments
 (0)