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>
diff --git a/dwds/test/instances/common/patterns_inspection_common.dart b/dwds/test/instances/common/patterns_inspection_common.dart
index 935ab91..5b1d68d 100644
--- a/dwds/test/instances/common/patterns_inspection_common.dart
+++ b/dwds/test/instances/common/patterns_inspection_common.dart
@@ -5,6 +5,7 @@
import 'package:test/test.dart';
import 'package:test_common/logging.dart';
import 'package:test_common/test_sdk_configuration.dart';
+import 'package:test_common/utilities.dart';
import 'package:vm_service/vm_service.dart';
import '../../fixtures/context.dart';
@@ -96,11 +97,24 @@
await onBreakPoint('testPatternCase2', (event) async {
final frame = event.topFrame!;
- expect(await getFrameVariables(frame), {
- 'obj': matchListInstance(type: 'Object'),
- 'a': matchPrimitiveInstance(kind: InstanceKind.kString, value: 'b'),
- 'n': matchPrimitiveInstance(kind: InstanceKind.kDouble, value: 3.14),
- });
+ if (dartSdkIsAtLeast('3.7.0-246.0.dev')) {
+ expect(await getFrameVariables(frame), {
+ 'obj': matchListInstance(type: 'Object'),
+ // Renamed to avoid shadowing variables from previous case.
+ 'a\$':
+ matchPrimitiveInstance(kind: InstanceKind.kString, value: 'b'),
+ 'n\$':
+ matchPrimitiveInstance(kind: InstanceKind.kDouble, value: 3.14),
+ });
+ } else {
+ expect(await getFrameVariables(frame), {
+ 'obj': matchListInstance(type: 'Object'),
+ // Renamed to avoid shadowing variables from previous case.
+ 'a': matchPrimitiveInstance(kind: InstanceKind.kString, value: 'b'),
+ 'n':
+ matchPrimitiveInstance(kind: InstanceKind.kDouble, value: 3.14),
+ });
+ }
});
});