| 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 |
| 43 testSetter(Isolate isolate) async { | 44 testSetter(Isolate isolate) async { |
| 44 Library rootLibrary = await isolate.rootLibrary.load(); | 45 Library rootLibrary = await isolate.rootLibrary.load(); |
| 45 expect(rootLibrary.classes.length, equals(1)); | 46 expect(rootLibrary.classes.length, equals(1)); |
| 46 Class classA = await rootLibrary.classes[0].load(); | 47 Class classA = await rootLibrary.classes[0].load(); |
| 47 expect(classA.name, equals('A')); | 48 expect(classA.name, equals('A')); |
| 48 // Find setter. | 49 // Find setter. |
| 49 ServiceFunction setterFunc; | 50 ServiceFunction setterFunc; |
| 50 for (ServiceFunction function in classA.functions) { | 51 for (ServiceFunction function in classA.functions) { |
| 51 if (function.name == 'field=') { | 52 if (function.name == 'field=') { |
| 52 setterFunc = function; | 53 setterFunc = function; |
| 53 break; | 54 break; |
| 54 } | 55 } |
| 55 } | 56 } |
| 56 expect(setterFunc, isNotNull); | 57 expect(setterFunc, isNotNull); |
| 57 await setterFunc.load(); | 58 await setterFunc.load(); |
| 58 Field field = await setterFunc.field.load(); | 59 Field field = await setterFunc.field.load(); |
| 59 expect(field, isNotNull); | 60 expect(field, isNotNull); |
| 60 expect(field.name, equals('field')); | 61 expect(field.name, equals('field')); |
| 61 Class classDouble = await field.guardClass.load(); | 62 Class classDouble = await field.guardClass.load(); |
| 62 expect(classDouble.name, equals('_Double')); | 63 expect(classDouble.name, equals('_Double')); |
| 63 } | 64 } |
| 64 | 65 |
| 66 |
| 65 var tests = [testGetter, testSetter]; | 67 var tests = [testGetter, testSetter]; |
| 66 | 68 |
| 67 main(args) => runIsolateTests(args, tests, testeeBefore: script); | 69 main(args) => runIsolateTests(args, tests, testeeBefore: script); |
| OLD | NEW |