| 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 test.computer.element; | 5 library test.computer.element; |
| 6 | 6 |
| 7 import 'package:analysis_server/src/computer/element.dart'; | 7 import 'package:analysis_server/src/computer/element.dart'; |
| 8 import 'package:analysis_server/src/constants.dart'; | 8 import 'package:analysis_server/src/constants.dart'; |
| 9 import 'package:analysis_server/src/protocol2.dart' show ElementKind; | 9 import 'package:analysis_server/src/protocol2.dart' show ElementKind; |
| 10 import 'package:analysis_testing/abstract_context.dart'; | 10 import 'package:analysis_testing/abstract_context.dart'; |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 ElementKind.UNIT_TEST_TEST); | 70 ElementKind.UNIT_TEST_TEST); |
| 71 expect( | 71 expect( |
| 72 new ElementKind(ElementKind.UNIT_TEST_GROUP.name), | 72 new ElementKind(ElementKind.UNIT_TEST_GROUP.name), |
| 73 ElementKind.UNIT_TEST_GROUP); | 73 ElementKind.UNIT_TEST_GROUP); |
| 74 expect(new ElementKind(ElementKind.UNKNOWN.name), ElementKind.UNKNOWN); | 74 expect(new ElementKind(ElementKind.UNKNOWN.name), ElementKind.UNKNOWN); |
| 75 expect(() { | 75 expect(() { |
| 76 new ElementKind('no-such-kind'); | 76 new ElementKind('no-such-kind'); |
| 77 }, throws); | 77 }, throws); |
| 78 } | 78 } |
| 79 | 79 |
| 80 void test_valueOfEngine() { | 80 void test_fromEngine() { |
| 81 expect( | 81 expect( |
| 82 elementKindFromEngine(engine.ElementKind.CLASS), | 82 new ElementKind.fromEngine(engine.ElementKind.CLASS), |
| 83 ElementKind.CLASS); | 83 ElementKind.CLASS); |
| 84 expect( | 84 expect( |
| 85 elementKindFromEngine(engine.ElementKind.COMPILATION_UNIT), | 85 new ElementKind.fromEngine(engine.ElementKind.COMPILATION_UNIT), |
| 86 ElementKind.COMPILATION_UNIT); | 86 ElementKind.COMPILATION_UNIT); |
| 87 expect( | 87 expect( |
| 88 elementKindFromEngine(engine.ElementKind.CONSTRUCTOR), | 88 new ElementKind.fromEngine(engine.ElementKind.CONSTRUCTOR), |
| 89 ElementKind.CONSTRUCTOR); | 89 ElementKind.CONSTRUCTOR); |
| 90 expect( | 90 expect( |
| 91 elementKindFromEngine(engine.ElementKind.FIELD), | 91 new ElementKind.fromEngine(engine.ElementKind.FIELD), |
| 92 ElementKind.FIELD); | 92 ElementKind.FIELD); |
| 93 expect( | 93 expect( |
| 94 elementKindFromEngine(engine.ElementKind.FUNCTION), | 94 new ElementKind.fromEngine(engine.ElementKind.FUNCTION), |
| 95 ElementKind.FUNCTION); | 95 ElementKind.FUNCTION); |
| 96 expect( | 96 expect( |
| 97 elementKindFromEngine(engine.ElementKind.FUNCTION_TYPE_ALIAS), | 97 new ElementKind.fromEngine(engine.ElementKind.FUNCTION_TYPE_ALIAS), |
| 98 ElementKind.FUNCTION_TYPE_ALIAS); | 98 ElementKind.FUNCTION_TYPE_ALIAS); |
| 99 expect( | 99 expect( |
| 100 elementKindFromEngine(engine.ElementKind.GETTER), | 100 new ElementKind.fromEngine(engine.ElementKind.GETTER), |
| 101 ElementKind.GETTER); | 101 ElementKind.GETTER); |
| 102 expect( | 102 expect( |
| 103 elementKindFromEngine(engine.ElementKind.LIBRARY), | 103 new ElementKind.fromEngine(engine.ElementKind.LIBRARY), |
| 104 ElementKind.LIBRARY); | 104 ElementKind.LIBRARY); |
| 105 expect( | 105 expect( |
| 106 elementKindFromEngine(engine.ElementKind.LOCAL_VARIABLE), | 106 new ElementKind.fromEngine(engine.ElementKind.LOCAL_VARIABLE), |
| 107 ElementKind.LOCAL_VARIABLE); | 107 ElementKind.LOCAL_VARIABLE); |
| 108 expect( | 108 expect( |
| 109 elementKindFromEngine(engine.ElementKind.METHOD), | 109 new ElementKind.fromEngine(engine.ElementKind.METHOD), |
| 110 ElementKind.METHOD); | 110 ElementKind.METHOD); |
| 111 expect( | 111 expect( |
| 112 elementKindFromEngine(engine.ElementKind.PARAMETER), | 112 new ElementKind.fromEngine(engine.ElementKind.PARAMETER), |
| 113 ElementKind.PARAMETER); | 113 ElementKind.PARAMETER); |
| 114 expect( | 114 expect( |
| 115 elementKindFromEngine(engine.ElementKind.SETTER), | 115 new ElementKind.fromEngine(engine.ElementKind.SETTER), |
| 116 ElementKind.SETTER); | 116 ElementKind.SETTER); |
| 117 expect( | 117 expect( |
| 118 elementKindFromEngine(engine.ElementKind.TOP_LEVEL_VARIABLE), | 118 new ElementKind.fromEngine(engine.ElementKind.TOP_LEVEL_VARIABLE), |
| 119 ElementKind.TOP_LEVEL_VARIABLE); | 119 ElementKind.TOP_LEVEL_VARIABLE); |
| 120 expect( | 120 expect( |
| 121 elementKindFromEngine(engine.ElementKind.TYPE_PARAMETER), | 121 new ElementKind.fromEngine(engine.ElementKind.TYPE_PARAMETER), |
| 122 ElementKind.TYPE_PARAMETER); | 122 ElementKind.TYPE_PARAMETER); |
| 123 expect( | 123 expect( |
| 124 elementKindFromEngine(engine.ElementKind.ANGULAR_COMPONENT), | 124 new ElementKind.fromEngine(engine.ElementKind.ANGULAR_COMPONENT), |
| 125 ElementKind.UNKNOWN); | 125 ElementKind.UNKNOWN); |
| 126 } | 126 } |
| 127 } | 127 } |
| 128 | 128 |
| 129 | 129 |
| 130 @ReflectiveTestCase() | 130 @ReflectiveTestCase() |
| 131 class ElementTest extends AbstractContextTest { | 131 class ElementTest extends AbstractContextTest { |
| 132 engine.Element findElementInUnit(CompilationUnit unit, String name, | 132 engine.Element findElementInUnit(CompilationUnit unit, String name, |
| 133 [engine.ElementKind kind]) { | 133 [engine.ElementKind kind]) { |
| 134 return findChildElement(unit.element, name, kind); | 134 return findChildElement(unit.element, name, kind); |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 FLAGS: Element.FLAG_DEPRECATED | | 310 FLAGS: Element.FLAG_DEPRECATED | |
| 311 Element.FLAG_PRIVATE | | 311 Element.FLAG_PRIVATE | |
| 312 Element.FLAG_STATIC, | 312 Element.FLAG_STATIC, |
| 313 PARAMETERS: '(int a, String b)', | 313 PARAMETERS: '(int a, String b)', |
| 314 RETURN_TYPE: 'List<String>' | 314 RETURN_TYPE: 'List<String>' |
| 315 }; | 315 }; |
| 316 Element element = new Element.fromJson(json); | 316 Element element = new Element.fromJson(json); |
| 317 expect(element.toJson(), equals(json)); | 317 expect(element.toJson(), equals(json)); |
| 318 } | 318 } |
| 319 } | 319 } |
| OLD | NEW |