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 library implicit_getter_setter_test; | 5 library implicit_getter_setter_test; |
6 | 6 |
7 import 'package:observatory/service_io.dart'; | 7 import 'package:observatory/service_io.dart'; |
8 import 'package:unittest/unittest.dart'; | 8 import 'package:unittest/unittest.dart'; |
9 import 'test_helper.dart'; | 9 import 'test_helper.dart'; |
10 | 10 |
(...skipping 22 matching lines...) Expand all Loading... |
33 } | 33 } |
34 expect(getterFunc, isNotNull); | 34 expect(getterFunc, isNotNull); |
35 await getterFunc.load(); | 35 await getterFunc.load(); |
36 Field field = await getterFunc.field.load(); | 36 Field field = await getterFunc.field.load(); |
37 expect(field, isNotNull); | 37 expect(field, isNotNull); |
38 expect(field.name, equals('field')); | 38 expect(field.name, equals('field')); |
39 Class classDouble = await field.guardClass.load(); | 39 Class classDouble = await field.guardClass.load(); |
40 expect(classDouble.name, equals('_Double')); | 40 expect(classDouble.name, equals('_Double')); |
41 } | 41 } |
42 | 42 |
43 | |
44 testSetter(Isolate isolate) async { | 43 testSetter(Isolate isolate) async { |
45 Library rootLibrary = await isolate.rootLibrary.load(); | 44 Library rootLibrary = await isolate.rootLibrary.load(); |
46 expect(rootLibrary.classes.length, equals(1)); | 45 expect(rootLibrary.classes.length, equals(1)); |
47 Class classA = await rootLibrary.classes[0].load(); | 46 Class classA = await rootLibrary.classes[0].load(); |
48 expect(classA.name, equals('A')); | 47 expect(classA.name, equals('A')); |
49 // Find setter. | 48 // Find setter. |
50 ServiceFunction setterFunc; | 49 ServiceFunction setterFunc; |
51 for (ServiceFunction function in classA.functions) { | 50 for (ServiceFunction function in classA.functions) { |
52 if (function.name == 'field=') { | 51 if (function.name == 'field=') { |
53 setterFunc = function; | 52 setterFunc = function; |
54 break; | 53 break; |
55 } | 54 } |
56 } | 55 } |
57 expect(setterFunc, isNotNull); | 56 expect(setterFunc, isNotNull); |
58 await setterFunc.load(); | 57 await setterFunc.load(); |
59 Field field = await setterFunc.field.load(); | 58 Field field = await setterFunc.field.load(); |
60 expect(field, isNotNull); | 59 expect(field, isNotNull); |
61 expect(field.name, equals('field')); | 60 expect(field.name, equals('field')); |
62 Class classDouble = await field.guardClass.load(); | 61 Class classDouble = await field.guardClass.load(); |
63 expect(classDouble.name, equals('_Double')); | 62 expect(classDouble.name, equals('_Double')); |
64 } | 63 } |
65 | 64 |
66 | |
67 var tests = [testGetter, testSetter]; | 65 var tests = [testGetter, testSetter]; |
68 | 66 |
69 main(args) => runIsolateTests(args, tests, testeeBefore: script); | 67 main(args) => runIsolateTests(args, tests, testeeBefore: script); |
OLD | NEW |