Skip to content

Commit

Permalink
Version 3.8.0-33.0.dev
Browse files Browse the repository at this point in the history
Merge 862ca5b into dev
  • Loading branch information
Dart CI committed Jan 24, 2025
2 parents c056bfc + 862ca5b commit f5f23bc
Show file tree
Hide file tree
Showing 14 changed files with 178 additions and 138 deletions.
2 changes: 0 additions & 2 deletions pkg/frontend_server/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,5 @@ dependencies:
# Use 'any' constraints here; we get our versions from the DEPS file.
dev_dependencies:
collection: any
const_finder_fixtures: any
const_finder_fixtures_package: any
lints: any
test: any
24 changes: 12 additions & 12 deletions pkg/frontend_server/test/const_finder_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ void _checkConsts(String dillPath, Compiler compiler) {
expectation['nonConstantLocations'] = <Object?>[
<String, dynamic>{
'file': 'file://$fixturesUrl/pkg/package.dart',
'line': 13,
'line': 17,
'column': 25,
},
];
Expand Down Expand Up @@ -256,27 +256,27 @@ void _checkNonConstsFrontend(String dillPath, Compiler compiler) {
'nonConstantLocations': <dynamic>[
<String, dynamic>{
'file': 'file://$fixturesUrl/lib/consts_and_non.dart',
'line': 13,
'line': 17,
'column': 26,
},
<String, dynamic>{
'file': 'file://$fixturesUrl/lib/consts_and_non.dart',
'line': 16,
'line': 20,
'column': 7,
},
<String, dynamic>{
'file': 'file://$fixturesUrl/lib/consts_and_non.dart',
'line': 16,
'line': 20,
'column': 22,
},
<String, dynamic>{
'file': 'file://$fixturesUrl/lib/consts_and_non.dart',
'line': 17,
'line': 21,
'column': 26,
},
<String, dynamic>{
'file': 'file://$fixturesUrl/pkg/package.dart',
'line': 13,
'line': 17,
'column': 25,
}
]
Expand Down Expand Up @@ -343,27 +343,27 @@ void _checkNonConstsWeb(String dillPath, Compiler compiler) {
'nonConstantLocations': <dynamic>[
<String, dynamic>{
'file': 'file://$fixturesUrl/lib/consts_and_non.dart',
'line': 13,
'line': 17,
'column': 26,
},
<String, dynamic>{
'file': 'file://$fixturesUrl/lib/consts_and_non.dart',
'line': 16,
'line': 20,
'column': 7,
},
<String, dynamic>{
'file': 'file://$fixturesUrl/lib/consts_and_non.dart',
'line': 16,
'line': 20,
'column': 22,
},
<String, dynamic>{
'file': 'file://$fixturesUrl/lib/consts_and_non.dart',
'line': 17,
'line': 21,
'column': 26,
},
<String, dynamic>{
'file': 'file://$fixturesUrl/pkg/package.dart',
'line': 13,
'line': 17,
'column': 25,
}
],
Expand Down Expand Up @@ -581,4 +581,4 @@ class Dart2JSDeepCollectionEquality extends DeepCollectionEquality {
}
return super.equals(e1, e2);
}
}
}
4 changes: 4 additions & 0 deletions pkg/frontend_server/test/fixtures/lib/consts.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

// This test is always used with a custom package_config.json, so don't validate
// the imports against the pubspec.yaml.
// @skip_package_deps_validation

import 'dart:core';

import 'package:const_finder_fixtures_package/package.dart';
Expand Down
4 changes: 4 additions & 0 deletions pkg/frontend_server/test/fixtures/lib/consts_and_non.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

// This test is always used with a custom package_config.json, so don't validate
// the imports against the pubspec.yaml.
// @skip_package_deps_validation

import 'dart:core';

import 'package:const_finder_fixtures_package/package.dart';
Expand Down
4 changes: 4 additions & 0 deletions pkg/frontend_server/test/fixtures/pkg/package.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

// This test is always used with a custom package_config.json, so don't validate
// the imports against the pubspec.yaml.
// @skip_package_deps_validation

import 'package:const_finder_fixtures/target.dart';

void createTargetInPackage() {
Expand Down
1 change: 1 addition & 0 deletions pkg/pkg.status
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ vm_service/test/issue_27287_test: SkipByDesign # Debugger is disabled in AOT mod
vm_service/test/issue_30555_test: SkipByDesign # Debugger is disabled in AOT mode.
vm_service/test/issue_56911_test: SkipByDesign # Debugger is disabled in AOT mode.
vm_service/test/issue_57040_test: SkipByDesign # Debugger is disabled in AOT mode.
vm_service/test/issue_59653_test: SkipByDesign # Debugger is disabled in AOT mode.
vm_service/test/issue_59661_test: SkipByDesign # Debugger is disabled in AOT mode.
vm_service/test/kill_paused_test: SkipByDesign # Debugger is disabled in AOT mode.
vm_service/test/library_dependency_test: SkipByDesign # Uses 'dart:mirrors' library.
Expand Down
38 changes: 38 additions & 0 deletions pkg/vm_service/test/common/service_test_common.dart
Original file line number Diff line number Diff line change
Expand Up @@ -889,3 +889,41 @@ IsolateTest expectUnhandledExceptionWithFrames({
}
};
}

/// This helper does 3 things:
/// 1) makes sure it's at the expected frame ([topFrameName]).
/// 2) checks that the expected variables are available (by name)
/// ([availableVariables]).
/// 3) Evaluates the given expression(s) and checks their (valueAsString) result
/// ([evaluations]).
IsolateTest testExpressionEvaluationAndAvailableVariables(
String topFrameName,
List<String> availableVariables,
List<(String evaluate, String evaluationResult)> evaluations,
) {
return (VmService service, IsolateRef isolateRef) async {
final isolateId = isolateRef.id!;
final stack = await service.getStack(isolateId);

// Make sure we are in the right place.
expect(stack.frames!.length, greaterThanOrEqualTo(1));
expect(stack.frames![0].function!.name, topFrameName);

// Check variables.
expect(
(stack.frames![0].vars ?? []).map((v) => v.name).toList(),
equals(availableVariables),
);

// Evaluate.
for (final (expression, expectedResult) in evaluations) {
final result = await service.evaluateInFrame(
isolateId,
/* frame = */ 0,
expression,
) as InstanceRef;
print(result.valueAsString);
expect(result.valueAsString, equals(expectedResult));
}
};
}
42 changes: 4 additions & 38 deletions pkg/vm_service/test/issue_56911_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
// BSD-style license that can be found in the LICENSE file.

import 'dart:developer';
import 'package:test/test.dart';
import 'package:vm_service/vm_service.dart';
import 'common/service_test_common.dart';
import 'common/test_helper.dart';

Expand All @@ -14,8 +12,8 @@ import 'common/test_helper.dart';
//
// dart pkg/vm_service/test/update_line_numbers.dart pkg/vm_service/test/issue_56911_test.dart
//
const LINE_A = 28;
const LINE_B = 32;
const LINE_A = 26;
const LINE_B = 30;
// AUTOGENERATED END

extension type ExtensionType._(String s) {
Expand All @@ -34,42 +32,10 @@ void code() {
});
}

Future<void> Function(VmService, IsolateRef) test(
String topFrameName,
List<String> availableVariables,
List<(String evaluate, String evaluationResult)> evaluations,
) {
return (VmService service, IsolateRef isolateRef) async {
final isolateId = isolateRef.id!;
final stack = await service.getStack(isolateId);

// Make sure we are in the right place.
expect(stack.frames!.length, greaterThanOrEqualTo(1));
expect(stack.frames![0].function!.name, topFrameName);

// Check variables.
expect(
(stack.frames![0].vars ?? []).map((v) => v.name).toList(),
equals(availableVariables),
);

// Evaluate.
for (final (expression, expectedResult) in evaluations) {
final result = await service.evaluateInFrame(
isolateId,
/* frame = */ 0,
expression,
) as InstanceRef;
print(result.valueAsString);
expect(result.valueAsString, equals(expectedResult));
}
};
}

final tests = <IsolateTest>[
hasStoppedAtBreakpoint,
stoppedAtLine(LINE_A),
test('code', [
testExpressionEvaluationAndAvailableVariables('code', [
'list',
], [
('() { return list.single.value; }()', '48'),
Expand All @@ -78,7 +44,7 @@ final tests = <IsolateTest>[
resumeIsolate,
hasStoppedAtBreakpoint,
stoppedAtLine(LINE_B),
test('<anonymous closure>', [
testExpressionEvaluationAndAvailableVariables('<anonymous closure>', [
'input',
], [
('() { return input.value; }()', '48'),
Expand Down
42 changes: 4 additions & 38 deletions pkg/vm_service/test/issue_57040_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
// BSD-style license that can be found in the LICENSE file.

import 'dart:developer';
import 'package:test/test.dart';
import 'package:vm_service/vm_service.dart';
import 'common/service_test_common.dart';
import 'common/test_helper.dart';

Expand All @@ -14,8 +12,8 @@ import 'common/test_helper.dart';
//
// dart pkg/vm_service/test/update_line_numbers.dart pkg/vm_service/test/issue_57040_test.dart
//
const LINE_A = 30;
const LINE_B = 33;
const LINE_A = 28;
const LINE_B = 31;
// AUTOGENERATED END

extension on String? {
Expand All @@ -34,42 +32,10 @@ void code() {
print(str.isNullOrEmpty);
}

Future<void> Function(VmService, IsolateRef) test(
String topFrameName,
List<String> availableVariables,
List<(String evaluate, String evaluationResult)> evaluations,
) {
return (VmService service, IsolateRef isolateRef) async {
final isolateId = isolateRef.id!;
final stack = await service.getStack(isolateId);

// Make sure we are in the right place.
expect(stack.frames!.length, greaterThanOrEqualTo(1));
expect(stack.frames![0].function!.name, topFrameName);

// Check variables.
expect(
(stack.frames![0].vars ?? []).map((v) => v.name).toList(),
equals(availableVariables),
);

// Evaluate.
for (final (expression, expectedResult) in evaluations) {
final result = await service.evaluateInFrame(
isolateId,
/* frame = */ 0,
expression,
) as InstanceRef;
print(result.valueAsString);
expect(result.valueAsString, equals(expectedResult));
}
};
}

final tests = <IsolateTest>[
hasStoppedAtBreakpoint,
stoppedAtLine(LINE_A),
test('code', [
testExpressionEvaluationAndAvailableVariables('code', [
'str',
], [
('() { return str.isNullOrEmpty; }()', 'false'),
Expand All @@ -78,7 +44,7 @@ final tests = <IsolateTest>[
resumeIsolate,
hasStoppedAtBreakpoint,
stoppedAtLine(LINE_B),
test('code', [
testExpressionEvaluationAndAvailableVariables('code', [
'str',
], [
('() { return str.isNullOrEmpty; }()', 'true'),
Expand Down
64 changes: 64 additions & 0 deletions pkg/vm_service/test/issue_59653_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

import 'dart:developer';
import 'common/service_test_common.dart';
import 'common/test_helper.dart';

// AUTOGENERATED START
//
// Update these constants by running:
//
// dart pkg/vm_service/test/update_line_numbers.dart pkg/vm_service/test/issue_59653_test.dart
//
const LINE_A = 36;
// AUTOGENERATED END

abstract interface class SharedTypeStructure {}

extension type SharedTypeSchemaView<TypeStructure extends SharedTypeStructure>(
TypeStructure _typeStructure) implements Object {}

class C extends SharedTypeStructure {
@override
String toString() => 'C!';
}

class ClassWithTypeAnalyzer<TypeStructure extends SharedTypeStructure> {
SharedTypeSchemaView<TypeStructure> dispatchExpression(
SharedTypeSchemaView<TypeStructure> schema,
) {
return schema;
}

void analyzeExpression(SharedTypeSchemaView<TypeStructure> schema) {
debugger(); // LINE_A
}
}

void code() {
final classWithTypeAnalyzer = ClassWithTypeAnalyzer<C>();
classWithTypeAnalyzer.analyzeExpression(SharedTypeSchemaView(C()));
}

final tests = <IsolateTest>[
hasStoppedAtBreakpoint,
stoppedAtLine(LINE_A),
testExpressionEvaluationAndAvailableVariables('analyzeExpression', [
'this',
'schema',
], [
('1', '1'),
('dispatchExpression(schema).toString()', 'C!'),
]),
];

void main([args = const <String>[]]) => runIsolateTests(
args,
tests,
'issue_59653_test.dart',
testeeConcurrent: code,
pauseOnStart: false,
pauseOnExit: true,
);
Loading

0 comments on commit f5f23bc

Please sign in to comment.