Skip to content

Commit

Permalink
Update pattern test to account for new DDC JS variable naming (#2542)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
biggs0125 and natebiggs authored Dec 13, 2024
1 parent ab620d1 commit 4d0ef25
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions dwds/test/instances/common/patterns_inspection_common.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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),
});
}
});
});

Expand Down

0 comments on commit 4d0ef25

Please sign in to comment.