| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 inbound_references_test; | 5 library inbound_references_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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 (Isolate isolate) => | 65 (Isolate isolate) => |
| 66 isolate.rootLib.load().then((Library lib) { | 66 isolate.rootLib.load().then((Library lib) { |
| 67 Field field = lib.variables.singleWhere((v) => v.name == 'copyingBlock'); | 67 Field field = lib.variables.singleWhere((v) => v.name == 'copyingBlock'); |
| 68 return field.value.load().then((Instance block) { | 68 return field.value.load().then((Instance block) { |
| 69 expect(block.isClosure, isTrue); | 69 expect(block.isClosure, isTrue); |
| 70 expect(block.closureCtxt.isContext, isTrue); | 70 expect(block.closureCtxt.isContext, isTrue); |
| 71 expect(block.closureCtxt.length, equals(1)); | 71 expect(block.closureCtxt.length, equals(1)); |
| 72 return block.closureCtxt.load().then((Context ctxt) { | 72 return block.closureCtxt.load().then((Context ctxt) { |
| 73 expect(ctxt.variables.single['value'].isString, isTrue); | 73 expect(ctxt.variables.single['value'].isString, isTrue); |
| 74 expect(ctxt.variables.single['value'].valueAsString, equals('I could be
copied into the block')); | 74 expect(ctxt.variables.single['value'].valueAsString, equals('I could be
copied into the block')); |
| 75 expect(block.closureCtxt.parentContext.isNull, isTrue); | 75 expect(ctxt.parentContext.isContext, isTrue); |
| 76 expect(ctxt.parentContext.length, equals(0)); |
| 77 return ctxt.parentContext.load().then((Context outerCtxt) { |
| 78 expect(outerCtxt.parentContext.isNull, isTrue); |
| 79 }); |
| 76 }); | 80 }); |
| 77 }); | 81 }); |
| 78 }), | 82 }), |
| 79 | 83 |
| 80 (Isolate isolate) => | 84 (Isolate isolate) => |
| 81 isolate.rootLib.load().then((Library lib) { | 85 isolate.rootLib.load().then((Library lib) { |
| 82 Field field = lib.variables.singleWhere((v) => v.name == 'fullBlock'); | 86 Field field = lib.variables.singleWhere((v) => v.name == 'fullBlock'); |
| 83 return field.value.load().then((Instance block) { | 87 return field.value.load().then((Instance block) { |
| 84 expect(block.isClosure, isTrue); | 88 expect(block.isClosure, isTrue); |
| 85 expect(block.closureCtxt.isContext, isTrue); | 89 expect(block.closureCtxt.isContext, isTrue); |
| 86 expect(block.closureCtxt.length, equals(1)); | 90 expect(block.closureCtxt.length, equals(1)); |
| 87 return block.closureCtxt.load().then((ctxt) { | 91 return block.closureCtxt.load().then((ctxt) { |
| 88 expect(ctxt.variables.single['value'].isInt, isTrue); | 92 expect(ctxt.variables.single['value'].isInt, isTrue); |
| 89 expect(ctxt.variables.single['value'].valueAsString, equals('43')); | 93 expect(ctxt.variables.single['value'].valueAsString, equals('43')); |
| 90 expect(ctxt.parentContext.isNull, isTrue); | 94 expect(ctxt.parentContext.isContext, isTrue); |
| 95 expect(ctxt.parentContext.length, equals(0)); |
| 96 return ctxt.parentContext.load().then((Context outerCtxt) { |
| 97 expect(outerCtxt.parentContext.isNull, isTrue); |
| 98 }); |
| 91 }); | 99 }); |
| 92 }); | 100 }); |
| 93 }), | 101 }), |
| 94 | 102 |
| 95 (Isolate isolate) => | 103 (Isolate isolate) => |
| 96 isolate.rootLib.load().then((Library lib) { | 104 isolate.rootLib.load().then((Library lib) { |
| 97 Field field = lib.variables.singleWhere((v) => v.name == 'fullBlockWithChain
'); | 105 Field field = lib.variables.singleWhere((v) => v.name == 'fullBlockWithChain
'); |
| 98 return field.value.load().then((Instance block) { | 106 return field.value.load().then((Instance block) { |
| 99 expect(block.isClosure, isTrue); | 107 expect(block.isClosure, isTrue); |
| 100 expect(block.closureCtxt.isContext, isTrue); | 108 expect(block.closureCtxt.isContext, isTrue); |
| 101 expect(block.closureCtxt.length, equals(1)); | 109 expect(block.closureCtxt.length, equals(1)); |
| 102 return block.closureCtxt.load().then((Context ctxt) { | 110 return block.closureCtxt.load().then((Context ctxt) { |
| 103 expect(ctxt.variables.single['value'].isInt, isTrue); | 111 expect(ctxt.variables.single['value'].isInt, isTrue); |
| 104 expect(ctxt.variables.single['value'].valueAsString, equals('4201')); | 112 expect(ctxt.variables.single['value'].valueAsString, equals('4201')); |
| 105 expect(ctxt.parentContext.isContext, isTrue); | 113 expect(ctxt.parentContext.isContext, isTrue); |
| 106 expect(ctxt.parentContext.length, equals(1)); | 114 expect(ctxt.parentContext.length, equals(1)); |
| 107 return ctxt.parentContext.load().then((Context outerCtxt) { | 115 return ctxt.parentContext.load().then((Context outerCtxt) { |
| 108 expect(outerCtxt.variables.single['value'].isInt, isTrue); | 116 expect(outerCtxt.variables.single['value'].isInt, isTrue); |
| 109 expect(outerCtxt.variables.single['value'].valueAsString, equals('421'
)); | 117 expect(outerCtxt.variables.single['value'].valueAsString, equals('421'
)); |
| 110 expect(outerCtxt.parentContext.isNull, isTrue); | 118 expect(outerCtxt.parentContext.isContext, isTrue); |
| 119 expect(outerCtxt.parentContext.length, equals(0)); |
| 120 return outerCtxt.parentContext.load().then((Context outerCtxt2) { |
| 121 expect(outerCtxt2.parentContext.isNull, isTrue); |
| 122 }); |
| 111 }); | 123 }); |
| 112 }); | 124 }); |
| 113 }); | 125 }); |
| 114 }), | 126 }), |
| 115 | 127 |
| 116 ]; | 128 ]; |
| 117 | 129 |
| 118 main(args) => runIsolateTests(args, tests, testeeBefore: script); | 130 main(args) => runIsolateTests(args, tests, testeeBefore: script); |
| OLD | NEW |