| 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 import 'package:analysis_server/plugin/protocol/protocol.dart'; | 5 import 'package:analysis_server/plugin/protocol/protocol.dart'; |
| 6 import 'package:test/test.dart'; | 6 import 'package:test/test.dart'; |
| 7 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 7 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
| 8 | 8 |
| 9 import '../integration_tests.dart'; | 9 import '../integration_tests.dart'; |
| 10 | 10 |
| 11 main() { | 11 main() { |
| 12 defineReflectiveSuite(() { | 12 defineReflectiveSuite(() { |
| 13 defineReflectiveTests(OccurrencesTest); | 13 defineReflectiveTests(OccurrencesTest); |
| 14 defineReflectiveTests(OccurrencesTest_Driver); | |
| 15 }); | 14 }); |
| 16 } | 15 } |
| 17 | 16 |
| 18 class AbstractOccurrencesTest extends AbstractAnalysisServerIntegrationTest { | 17 @reflectiveTest |
| 18 class OccurrencesTest extends AbstractAnalysisServerIntegrationTest { |
| 19 test_occurrences() { | 19 test_occurrences() { |
| 20 String pathname = sourcePath('test.dart'); | 20 String pathname = sourcePath('test.dart'); |
| 21 String text = r''' | 21 String text = r''' |
| 22 main() { | 22 main() { |
| 23 int sum = 0; | 23 int sum = 0; |
| 24 for (int i = 0; i < 10; i++) { | 24 for (int i = 0; i < 10; i++) { |
| 25 for (int j = 0; j < i; j++) { | 25 for (int j = 0; j < i; j++) { |
| 26 sum += j; | 26 sum += j; |
| 27 } | 27 } |
| 28 } | 28 } |
| (...skipping 29 matching lines...) Expand all Loading... |
| 58 Set<int> foundOffsets = findOffsets(elementName); | 58 Set<int> foundOffsets = findOffsets(elementName); |
| 59 expect(foundOffsets, equals(expectedOffsets)); | 59 expect(foundOffsets, equals(expectedOffsets)); |
| 60 } | 60 } |
| 61 | 61 |
| 62 check('i', ['i = 0', 'i < 10', 'i++', 'i;']); | 62 check('i', ['i = 0', 'i < 10', 'i++', 'i;']); |
| 63 check('j', ['j = 0', 'j < i', 'j++', 'j;']); | 63 check('j', ['j = 0', 'j < i', 'j++', 'j;']); |
| 64 check('sum', ['sum = 0', 'sum +=', 'sum)']); | 64 check('sum', ['sum = 0', 'sum +=', 'sum)']); |
| 65 }); | 65 }); |
| 66 } | 66 } |
| 67 } | 67 } |
| 68 | |
| 69 @reflectiveTest | |
| 70 class OccurrencesTest extends AbstractOccurrencesTest {} | |
| 71 | |
| 72 @reflectiveTest | |
| 73 class OccurrencesTest_Driver extends AbstractOccurrencesTest { | |
| 74 @override | |
| 75 bool get enableNewAnalysisDriver => true; | |
| 76 } | |
| OLD | NEW |