Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(242)

Unified Diff: pkg/analysis_server/test/operation/operation_analysis_test.dart

Issue 415263002: Drop 'errorToJson', use server's AnalysisError. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analysis_server/test/computer/error_test.dart ('k') | pkg/analysis_server/test/operation/test_all.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/test/operation/operation_analysis_test.dart
diff --git a/pkg/analysis_server/test/operation/operation_analysis_test.dart b/pkg/analysis_server/test/operation/operation_analysis_test.dart
deleted file mode 100644
index ee6dc811b2d9c4ae224ae94da5c40dab7c51814b..0000000000000000000000000000000000000000
--- a/pkg/analysis_server/test/operation/operation_analysis_test.dart
+++ /dev/null
@@ -1,100 +0,0 @@
-// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library test.operation.analysis;
-
-import 'package:analysis_server/src/operation/operation_analysis.dart';
-import 'package:analysis_services/constants.dart';
-import 'package:analysis_testing/mocks.dart';
-import 'package:analysis_testing/reflective_tests.dart';
-import 'package:analyzer/src/generated/error.dart';
-import 'package:analyzer/src/generated/source.dart';
-import 'package:typed_mock/typed_mock.dart';
-import 'package:unittest/unittest.dart';
-
-
-main() {
- groupSep = ' | ';
- runReflectiveTests(Test_errorToJson);
-}
-
-
-class AnalysisErrorMock extends TypedMock implements AnalysisError {
- noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
-}
-
-
-@ReflectiveTestCase()
-class Test_errorToJson {
- Source source = new MockSource();
- LineInfo lineInfo;
- AnalysisError analysisError = new AnalysisErrorMock();
-
- void setUp() {
- // prepare Source
- when(source.fullName).thenReturn('foo.dart');
- // prepare LineInfo
- lineInfo = new LineInfo([0, 5, 9, 20]);
- // prepare AnalysisError
- when(analysisError.source).thenReturn(source);
- when(analysisError.errorCode).thenReturn(
- CompileTimeErrorCode.AMBIGUOUS_EXPORT);
- when(analysisError.message).thenReturn('my message');
- when(analysisError.offset).thenReturn(10);
- when(analysisError.length).thenReturn(20);
- }
-
- void tearDown() {
- source = null;
- analysisError = null;
- }
-
- void test_noCorrection() {
- Map<String, Object> json = errorToJson(lineInfo, analysisError);
- expect(json, {
- SEVERITY: 'ERROR',
- TYPE: 'COMPILE_TIME_ERROR',
- LOCATION: {
- FILE: 'foo.dart',
- OFFSET: 10,
- LENGTH: 20,
- START_LINE: 3,
- START_COLUMN: 2
- },
- MESSAGE: 'my message'
- });
- }
-
- void test_noLineInfo() {
- Map<String, Object> json = errorToJson(null, analysisError);
- expect(json, {
- SEVERITY: 'ERROR',
- TYPE: 'COMPILE_TIME_ERROR',
- LOCATION: {
- FILE: 'foo.dart',
- OFFSET: 10,
- LENGTH: 20
- },
- MESSAGE: 'my message'
- });
- }
-
- void test_withCorrection() {
- when(analysisError.correction).thenReturn('my correction');
- Map<String, Object> json = errorToJson(lineInfo, analysisError);
- expect(json, {
- SEVERITY: 'ERROR',
- TYPE: 'COMPILE_TIME_ERROR',
- LOCATION: {
- FILE: 'foo.dart',
- OFFSET: 10,
- LENGTH: 20,
- START_LINE: 3,
- START_COLUMN: 2
- },
- MESSAGE: 'my message',
- CORRECTION: 'my correction'
- });
- }
-}
« no previous file with comments | « pkg/analysis_server/test/computer/error_test.dart ('k') | pkg/analysis_server/test/operation/test_all.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698