OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 import 'dart:async'; | 5 import 'dart:async'; |
6 import 'dart:typed_data'; | 6 import 'dart:typed_data'; |
7 | 7 |
8 import 'package:vm_service_client/vm_service_client.dart'; | 8 import 'package:vm_service_client/vm_service_client.dart'; |
9 import 'package:test/test.dart'; | 9 import 'package:test/test.dart'; |
10 | 10 |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 var context = await value.context.load(); | 323 var context = await value.context.load(); |
324 expect(context.variables, hasLength(1)); | 324 expect(context.variables, hasLength(1)); |
325 expect(context.variables.first, new isInstanceOf<VMIntInstanceRef>()); | 325 expect(context.variables.first, new isInstanceOf<VMIntInstanceRef>()); |
326 expect(context.parent.length, equals(0)); | 326 expect(context.parent.length, equals(0)); |
327 }); | 327 }); |
328 | 328 |
329 test("a type", () async { | 329 test("a type", () async { |
330 var value = await _evaluate("<int>[].runtimeType"); | 330 var value = await _evaluate("<int>[].runtimeType"); |
331 | 331 |
332 expect(value, new isInstanceOf<VMTypeInstanceRef>()); | 332 expect(value, new isInstanceOf<VMTypeInstanceRef>()); |
333 expect(value.name, equals("_GrowableList<int>")); | 333 expect(value.name, equals("List<int>")); |
334 expect(value.typeClass.name, equals("_GrowableList")); | 334 expect(value.typeClass.name, equals("_GrowableList")); |
335 | 335 |
336 value = await value.load(); | 336 value = await value.load(); |
337 var arguments = value.arguments; | 337 var arguments = value.arguments; |
338 expect(arguments.name, equals("<int>")); | 338 expect(arguments.name, equals("<int>")); |
339 | 339 |
340 arguments = await arguments.load(); | 340 arguments = await arguments.load(); |
341 expect(arguments.types, hasLength(1)); | 341 expect(arguments.types, hasLength(1)); |
342 expect(arguments.types.first, new isInstanceOf<VMTypeInstanceRef>()); | 342 expect(arguments.types.first, new isInstanceOf<VMTypeInstanceRef>()); |
343 expect(arguments.types.first.name, equals("int")); | 343 expect(arguments.types.first.name, equals("int")); |
344 }); | 344 }); |
345 }); | 345 }); |
346 } | 346 } |
347 | 347 |
348 Future<VMInstanceRef> _evaluate(String expression) async { | 348 Future<VMInstanceRef> _evaluate(String expression) async { |
349 var isolate = await (await client.getVM()).isolates.first.load(); | 349 var isolate = await (await client.getVM()).isolates.first.load(); |
350 return await isolate.rootLibrary.evaluate(expression); | 350 return await isolate.rootLibrary.evaluate(expression); |
351 } | 351 } |
OLD | NEW |