Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(116)

Side by Side Diff: runtime/observatory/tests/service/implicit_getter_setter_test.dart

Issue 1440753002: Include field reference with implicit getter / setter functions (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/observatory/lib/src/service/object.dart ('k') | runtime/vm/object.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 library implicit_getter_setter_test;
6
7 import 'package:observatory/service_io.dart';
8 import 'package:unittest/unittest.dart';
9 import 'test_helper.dart';
10
11 class A {
12 double field = 0.0;
13 }
14
15 script() {
16 for (int i = 0; i < 10; i++) {
17 new A();
18 }
19 }
20
21 testGetter(Isolate isolate) async {
22 Library rootLibrary = await isolate.rootLibrary.load();
23 expect(rootLibrary.classes.length, equals(1));
24 Class classA = await rootLibrary.classes[0].load();
25 expect(classA.name, equals('A'));
26 // Find getter.
27 ServiceFunction getterFunc;
28 for (ServiceFunction function in classA.functions) {
29 if (function.name == 'field') {
30 getterFunc = function;
31 break;
32 }
33 }
34 expect(getterFunc, isNotNull);
35 await getterFunc.load();
36 Field field = await getterFunc.field.load();
37 expect(field, isNotNull);
38 expect(field.name, equals('field'));
39 Class classDouble = await field.guardClass.load();
40 expect(classDouble.name, equals('_Double'));
41 }
42
43
44 testSetter(Isolate isolate) async {
45 Library rootLibrary = await isolate.rootLibrary.load();
46 expect(rootLibrary.classes.length, equals(1));
47 Class classA = await rootLibrary.classes[0].load();
48 expect(classA.name, equals('A'));
49 // Find setter.
50 ServiceFunction setterFunc;
51 for (ServiceFunction function in classA.functions) {
52 if (function.name == 'field=') {
53 setterFunc = function;
54 break;
55 }
56 }
57 expect(setterFunc, isNotNull);
58 await setterFunc.load();
59 Field field = await setterFunc.field.load();
60 expect(field, isNotNull);
61 expect(field.name, equals('field'));
62 Class classDouble = await field.guardClass.load();
63 expect(classDouble.name, equals('_Double'));
64 }
65
66
67 var tests = [testGetter, testSetter];
68
69 main(args) => runIsolateTests(args, tests, testeeBefore: script);
OLDNEW
« no previous file with comments | « runtime/observatory/lib/src/service/object.dart ('k') | runtime/vm/object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698