@@ -16,6 +16,7 @@ import 'package:dwds/src/services/expression_evaluator.dart';
1616import 'package:test/test.dart' ;
1717import 'package:webkit_inspection_protocol/webkit_inspection_protocol.dart' ;
1818
19+ import 'fixtures/context.dart' ;
1920import 'fixtures/fakes.dart' ;
2021
2122late ExpressionEvaluator ? _evaluator;
@@ -94,6 +95,41 @@ void main() async {
9495 .having ((o) => o.value, 'value' , 'true' ));
9596 });
9697
98+ test ('can evaluate expression in frame with null scope' , () async {
99+ // Verify that we don't get the internal error.
100+ // More extensive testing of 'evaluateExpressionInFrame' is done in
101+ // evaluation tests for frontend server and build daemon.
102+ await expectLater (
103+ evaluator.evaluateExpressionInFrame ('1' , 0 , 'true' , null ),
104+ throwsRPCErrorWithMessage (
105+ 'Cannot evaluate on a call frame when the program is not paused' ));
106+ });
107+
108+ test ('can evaluate expression in frame with empty scope' , () async {
109+ // Verify that we don't get the internal error.
110+ // More extensive testing of 'evaluateExpressionInFrame' is done in
111+ // evaluation tests for frontend server and build daemon.
112+ await expectLater (
113+ evaluator.evaluateExpressionInFrame ('1' , 0 , 'true' , {}),
114+ throwsRPCErrorWithMessage (
115+ 'Cannot evaluate on a call frame when the program is not paused' ));
116+ });
117+
118+ test ('cannot evaluate expression in frame with non-empty scope' ,
119+ () async {
120+ final result = await evaluator
121+ .evaluateExpressionInFrame ('1' , 0 , 'true' , {'a' : '1' });
122+ expect (
123+ result,
124+ const TypeMatcher <RemoteObject >()
125+ .having ((o) => o.type, 'type' , 'InternalError' )
126+ .having (
127+ (o) => o.value,
128+ 'value' ,
129+ contains (
130+ 'Using scope for expression evaluation in frame is not supported' )));
131+ });
132+
97133 test ('returns error if closed' , () async {
98134 evaluator.close ();
99135 final result =
0 commit comments