| OLD | NEW |
| (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 test.src.task.strong_mode_test; |
| 6 |
| 7 import 'package:analyzer/src/generated/ast.dart'; |
| 8 import 'package:analyzer/src/generated/source.dart'; |
| 9 import 'package:analyzer/src/task/strong_mode.dart'; |
| 10 import 'package:analyzer/task/dart.dart'; |
| 11 import 'package:unittest/unittest.dart'; |
| 12 |
| 13 import '../../reflective_tests.dart'; |
| 14 import '../../utils.dart'; |
| 15 import '../context/abstract_context.dart'; |
| 16 |
| 17 main() { |
| 18 initializeTestEnvironment(); |
| 19 runReflectiveTests(InferrenceFinderTest); |
| 20 } |
| 21 |
| 22 @reflectiveTest |
| 23 class InferrenceFinderTest extends AbstractContextTest { |
| 24 void test_creation() { |
| 25 InferrenceFinder finder = new InferrenceFinder(); |
| 26 expect(finder, isNotNull); |
| 27 expect(finder.classes, isEmpty); |
| 28 expect(finder.staticVariables, isEmpty); |
| 29 } |
| 30 |
| 31 void test_visit() { |
| 32 Source source = addSource( |
| 33 '/test.dart', |
| 34 r''' |
| 35 const c = 1; |
| 36 final f = ''; |
| 37 var v = const A(); |
| 38 class A { |
| 39 static final fa = 0; |
| 40 const A(); |
| 41 } |
| 42 class B extends A { |
| 43 static const cb = 1; |
| 44 static vb = 0; |
| 45 const ci = 2; |
| 46 final fi = ''; |
| 47 var vi; |
| 48 } |
| 49 class C = Object with A; |
| 50 typedef int F(int x); |
| 51 '''); |
| 52 computeResult(source, PARSED_UNIT); |
| 53 CompilationUnit unit = outputs[PARSED_UNIT]; |
| 54 InferrenceFinder finder = new InferrenceFinder(); |
| 55 unit.accept(finder); |
| 56 expect(finder.classes, hasLength(3)); |
| 57 expect(finder.staticVariables, hasLength(6)); |
| 58 } |
| 59 } |
| OLD | NEW |