From 4d0ef2588e1b3aa5dbe3baaa6200ffd88e55a4b4 Mon Sep 17 00:00:00 2001 From: Nate Biggs Date: Fri, 13 Dec 2024 17:11:34 -0500 Subject: [PATCH] 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 --- .../common/patterns_inspection_common.dart | 24 +++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/dwds/test/instances/common/patterns_inspection_common.dart b/dwds/test/instances/common/patterns_inspection_common.dart index 935ab91d8..5b1d68d6c 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 @@ void runTests({ 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), + }); + } }); });