OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 'package:observatory/service_io.dart'; | 5 import 'package:observatory/service_io.dart'; |
6 import 'package:unittest/unittest.dart'; | 6 import 'package:unittest/unittest.dart'; |
7 import 'test_helper.dart'; | 7 import 'test_helper.dart'; |
8 | 8 |
9 var tests = [ | 9 var tests = [ |
10 (Isolate isolate) async { | |
11 Library root = await isolate.rootLibrary.load(); | |
12 | 10 |
13 Class classLibrary = await root.clazz.load(); | 11 (Isolate isolate) async { |
14 print(classLibrary); | 12 Library root = await isolate.rootLibrary.load(); |
15 var result = await classLibrary.evaluate('3 + 4'); | |
16 print(result); | |
17 expect(result is DartError, isTrue); | |
18 expect(result.message, contains('Cannot evaluate')); | |
19 | 13 |
20 Class classClass = await classLibrary.clazz.load(); | 14 Class classLibrary = await root.clazz.load(); |
21 print(classClass); | 15 print(classLibrary); |
22 result = await classClass.evaluate('3 + 4'); | 16 var result = await classLibrary.evaluate('3 + 4'); |
23 print(result); | 17 print(result); |
24 expect(result is DartError, isTrue); | 18 expect(result is DartError, isTrue); |
25 expect(result.message, contains('Cannot evaluate')); | 19 expect(result.message, contains('Cannot evaluate')); |
26 | 20 |
27 var someArray = await root.evaluate("new List(2)"); | 21 Class classClass = await classLibrary.clazz.load(); |
28 print(someArray); | 22 print(classClass); |
29 expect(someArray is Instance, isTrue); | 23 result = await classClass.evaluate('3 + 4'); |
30 Class classArray = await someArray.clazz.load(); | 24 print(result); |
31 print(classArray); | 25 expect(result is DartError, isTrue); |
32 result = await classArray.evaluate('3 + 4'); | 26 expect(result.message, contains('Cannot evaluate')); |
33 print(result); | 27 |
34 expect(result is Instance, isTrue); | 28 var someArray = await root.evaluate("new List(2)"); |
35 expect(result.valueAsString, equals('7')); | 29 print(someArray); |
36 }, | 30 expect(someArray is Instance, isTrue); |
| 31 Class classArray = await someArray.clazz.load(); |
| 32 print(classArray); |
| 33 result = await classArray.evaluate('3 + 4'); |
| 34 print(result); |
| 35 expect(result is Instance, isTrue); |
| 36 expect(result.valueAsString, equals('7')); |
| 37 }, |
| 38 |
37 ]; | 39 ]; |
38 | 40 |
39 main(args) => runIsolateTests(args, tests); | 41 main(args) => runIsolateTests(args, tests); |
OLD | NEW |