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(); |
10 | 12 |
11 (Isolate isolate) async { | 13 Class classLibrary = await root.clazz.load(); |
12 Library root = await isolate.rootLibrary.load(); | 14 print(classLibrary); |
| 15 var result = await classLibrary.evaluate('3 + 4'); |
| 16 print(result); |
| 17 expect(result is DartError, isTrue); |
| 18 expect(result.message, contains('Cannot evaluate')); |
13 | 19 |
14 Class classLibrary = await root.clazz.load(); | 20 Class classClass = await classLibrary.clazz.load(); |
15 print(classLibrary); | 21 print(classClass); |
16 var result = await classLibrary.evaluate('3 + 4'); | 22 result = await classClass.evaluate('3 + 4'); |
17 print(result); | 23 print(result); |
18 expect(result is DartError, isTrue); | 24 expect(result is DartError, isTrue); |
19 expect(result.message, contains('Cannot evaluate')); | 25 expect(result.message, contains('Cannot evaluate')); |
20 | 26 |
21 Class classClass = await classLibrary.clazz.load(); | 27 var someArray = await root.evaluate("new List(2)"); |
22 print(classClass); | 28 print(someArray); |
23 result = await classClass.evaluate('3 + 4'); | 29 expect(someArray is Instance, isTrue); |
24 print(result); | 30 Class classArray = await someArray.clazz.load(); |
25 expect(result is DartError, isTrue); | 31 print(classArray); |
26 expect(result.message, contains('Cannot evaluate')); | 32 result = await classArray.evaluate('3 + 4'); |
27 | 33 print(result); |
28 var someArray = await root.evaluate("new List(2)"); | 34 expect(result is Instance, isTrue); |
29 print(someArray); | 35 expect(result.valueAsString, equals('7')); |
30 expect(someArray is Instance, isTrue); | 36 }, |
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 | |
39 ]; | 37 ]; |
40 | 38 |
41 main(args) => runIsolateTests(args, tests); | 39 main(args) => runIsolateTests(args, tests); |
OLD | NEW |