| 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 'dart:mirrors'; | 7 import 'dart:mirrors'; |
| 8 | 8 |
| 9 import 'package:analysis_server/src/constants.dart'; | 9 import 'package:analysis_server/src/constants.dart'; |
| 10 import 'package:analysis_server/src/protocol_server.dart'; | 10 import 'package:analysis_server/src/protocol_server.dart'; |
| 11 import 'package:analysis_server/src/services/search/search_engine.dart'; | 11 import 'package:analysis_server/src/services/search/search_engine.dart'; |
| 12 import 'package:analyzer/src/generated/ast.dart' as engine; | 12 import 'package:analyzer/src/generated/ast.dart' as engine; |
| 13 import 'package:analyzer/src/generated/element.dart' as engine; | 13 import 'package:analyzer/src/generated/element.dart' as engine; |
| 14 import 'package:analyzer/src/generated/error.dart' as engine; | 14 import 'package:analyzer/src/generated/error.dart' as engine; |
| 15 import 'package:analyzer/src/generated/source.dart' as engine; | 15 import 'package:analyzer/src/generated/source.dart' as engine; |
| 16 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 16 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
| 17 import 'package:typed_mock/typed_mock.dart'; | 17 import 'package:typed_mock/typed_mock.dart'; |
| 18 import 'package:unittest/unittest.dart'; | 18 import 'package:unittest/unittest.dart'; |
| 19 | 19 |
| 20 import 'mocks.dart'; | 20 import 'mocks.dart'; |
| 21 import 'utils.dart'; | 21 import 'utils.dart'; |
| 22 | 22 |
| 23 main() { | 23 main() { |
| 24 initializeTestEnvironment(); | 24 initializeTestEnvironment(); |
| 25 defineReflectiveTests(AnalysisErrorTest); | 25 defineReflectiveTests(AnalysisErrorTest); |
| 26 defineReflectiveTests(EnumTest); | 26 defineReflectiveTests(EnumTest); |
| 27 } | 27 } |
| 28 | 28 |
| 29 class AnalysisErrorMock extends TypedMock implements engine.AnalysisError { | 29 class AnalysisErrorMock extends TypedMock implements engine.AnalysisError {} |
| 30 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); | |
| 31 } | |
| 32 | 30 |
| 33 @reflectiveTest | 31 @reflectiveTest |
| 34 class AnalysisErrorTest { | 32 class AnalysisErrorTest { |
| 35 engine.Source source = new MockSource(); | 33 engine.Source source = new MockSource(); |
| 36 engine.LineInfo lineInfo; | 34 engine.LineInfo lineInfo; |
| 37 engine.AnalysisError engineError = new AnalysisErrorMock(); | 35 engine.AnalysisError engineError = new AnalysisErrorMock(); |
| 38 | 36 |
| 39 void setUp() { | 37 void setUp() { |
| 40 // prepare Source | 38 // prepare Source |
| 41 when(source.fullName).thenReturn('foo.dart'); | 39 when(source.fullName).thenReturn('foo.dart'); |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 ApiEnum apiValue = convert(engineValue); | 184 ApiEnum apiValue = convert(engineValue); |
| 187 expect(apiValue, equals(expectedResult)); | 185 expect(apiValue, equals(expectedResult)); |
| 188 } | 186 } |
| 189 } else { | 187 } else { |
| 190 ApiEnum apiValue = convert(engineValue); | 188 ApiEnum apiValue = convert(engineValue); |
| 191 expect(apiValue.name, equals(enumName)); | 189 expect(apiValue.name, equals(enumName)); |
| 192 } | 190 } |
| 193 }); | 191 }); |
| 194 } | 192 } |
| 195 } | 193 } |
| OLD | NEW |