| OLD | NEW |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 field_script_test; | 5 library field_script_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 import 'service_test_common.dart'; | 10 import 'service_test_common.dart'; |
| 11 | 11 |
| 12 part 'field_script_other.dart'; | 12 part 'field_script_other.dart'; |
| 13 | 13 |
| 14 code() { | 14 code() { |
| 15 print(otherField); | 15 print(otherField); |
| 16 } | 16 } |
| 17 | 17 |
| 18 var tests = [ | 18 var tests = [ |
| 19 hasPausedAtStart, | 19 hasPausedAtStart, |
| 20 (Isolate isolate) async { | 20 (Isolate isolate) async { |
| 21 Library lib = await isolate.rootLibrary.load(); | 21 Library lib = await isolate.rootLibrary.load(); |
| 22 var fields = lib.variables; | 22 var fields = lib.variables; |
| 23 expect(fields.length, 2); | 23 expect(fields.length, 2); |
| 24 print(lib.variables); | 24 print(lib.variables); |
| 25 for (Field f in fields) { | 25 for(Field f in fields) { |
| 26 await f.load(); | 26 await f.load(); |
| 27 String locationString = await f.location.toUserString(); | 27 String locationString = await f.location.toUserString(); |
| 28 if (f.name == "tests") { | 28 if (f.name == "tests") { |
| 29 expect(locationString, "field_script_test.dart:18:5"); | 29 expect(locationString, "field_script_test.dart:18:5"); |
| 30 } else if (f.name == "otherField") { | 30 } else if (f.name == "otherField") { |
| 31 expect(locationString, "field_script_other.dart:7:5"); | 31 expect(locationString, "field_script_other.dart:7:5"); |
| 32 } else { | 32 } else { |
| 33 fail("Unexpected field: ${f.name}"); | 33 fail("Unexpected field: ${f.name}"); |
| 34 } | 34 } |
| 35 } | 35 } |
| 36 } | 36 } |
| 37 ]; | 37 ]; |
| 38 | 38 |
| 39 main(args) { | 39 main(args) { |
| 40 runIsolateTestsSynchronous(args, tests, | 40 runIsolateTestsSynchronous(args, tests, |
| 41 testeeConcurrent: code, pause_on_start: true, pause_on_exit: true); | 41 testeeConcurrent: code, pause_on_start: true, pause_on_exit: true); |
| 42 } | 42 } |
| OLD | NEW |