@@ -16,6 +16,7 @@ import 'package:dwds/src/services/expression_evaluator.dart';
16
16
import 'package:test/test.dart' ;
17
17
import 'package:webkit_inspection_protocol/webkit_inspection_protocol.dart' ;
18
18
19
+ import 'fixtures/context.dart' ;
19
20
import 'fixtures/fakes.dart' ;
20
21
21
22
late ExpressionEvaluator ? _evaluator;
@@ -94,6 +95,41 @@ void main() async {
94
95
.having ((o) => o.value, 'value' , 'true' ));
95
96
});
96
97
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
+
97
133
test ('returns error if closed' , () async {
98
134
evaluator.close ();
99
135
final result =
0 commit comments