@@ -212,12 +212,12 @@ IsolateTest setBreakpointAtLineColumn(int line, int column) {
212212}
213213
214214extension FrameLocation on Frame {
215- Future <(String , int )> getLocation (
215+ Future <(String uri, ( int line, int column) )> getLocation (
216216 VmService service,
217217 IsolateRef isolateRef,
218218 ) async {
219219 if (location? .tokenPos == null ) {
220- return ('<unknown>' , - 1 );
220+ return ('<unknown>' , ( - 1 , - 1 ) );
221221 }
222222
223223 final script = (await service.getObject (
@@ -226,7 +226,10 @@ extension FrameLocation on Frame {
226226 )) as Script ;
227227 return (
228228 script.uri! ,
229- script.getLineNumberFromTokenPos (location! .tokenPos! ) ?? - 1
229+ (
230+ script.getLineNumberFromTokenPos (location! .tokenPos! ) ?? - 1 ,
231+ script.getColumnNumberFromTokenPos (location! .tokenPos! ) ?? - 1
232+ )
230233 );
231234 }
232235}
@@ -244,7 +247,7 @@ Future<String> formatFrames(
244247 sb.write (await qualifiedFunctionName (service, isolateRef, funcRef));
245248 }
246249 if (f.location != null ) {
247- final (uri, lineNo) = await f.getLocation (service, isolateRef);
250+ final (uri, ( lineNo) ) = await f.getLocation (service, isolateRef);
248251 sb.write (' $uri :$lineNo ' );
249252 }
250253 sb.writeln ();
@@ -267,9 +270,17 @@ Future<String> formatStack(
267270 return sb.toString ();
268271}
269272
270- IsolateTest stoppedAtLine (int line) {
273+ /// If column is [null] , this function checks that the isolate under test is
274+ /// currently paused at line [line] . Otherwise, this function checks that the
275+ /// isolate under test is currently paused at the location specified by [line]
276+ /// and [column] .
277+ IsolateTest stoppedAtLineColumn ({required int line, int ? column}) {
271278 return (VmService service, IsolateRef isolateRef) async {
272- print ('Checking we are at line $line ' );
279+ if (column == null ) {
280+ print ('Checking we are at line $line ' );
281+ } else {
282+ print ('Checking we are at $line :$column ' );
283+ }
273284
274285 // Make sure that the isolate has stopped.
275286 final id = isolateRef.id! ;
@@ -283,19 +294,32 @@ IsolateTest stoppedAtLine(int line) {
283294 expect (frames.length, greaterThanOrEqualTo (1 ));
284295
285296 final top = frames[0 ];
286- final (_, actualLine) = await top.getLocation (service, isolateRef);
297+ final (_, (actualLine, actualColumn)) =
298+ await top.getLocation (service, isolateRef);
287299 if (actualLine != line) {
288- print ('Actual: $actualLine Line: $line ' );
289300 final sb = StringBuffer ();
290- sb.write ('Expected to be at line $line but actually at line $actualLine ' );
301+ sb.writeln (
302+ 'Expected to be at line $line but actually at line $actualLine ' ,
303+ );
304+ sb.writeln (await formatStack (service, isolateRef, stack));
305+ throw sb.toString ();
306+ } else if (column != null && actualColumn != column) {
307+ final sb = StringBuffer ();
308+ sb.writeln (
309+ 'Expected to be at $line :$column but actually at $line :$actualColumn ' ,
310+ );
291311 sb.writeln (await formatStack (service, isolateRef, stack));
292312 throw sb.toString ();
293313 } else {
294- print ('Program is stopped at line: $ line ' );
314+ print ('Program is stopped at $ actualLine :$ actualColumn ' );
295315 }
296316 };
297317}
298318
319+ IsolateTest stoppedAtLine (int line) {
320+ return stoppedAtLineColumn (line: line);
321+ }
322+
299323Future <void > resumeIsolate (VmService service, IsolateRef isolate) async {
300324 final Completer completer = Completer ();
301325 late StreamSubscription <Event > subscription;
0 commit comments